using System.Linq;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;

namespace SlnMesnac.Repository.service
{
    public class BaseCodeServiceImpl:BaseServiceImpl<BaseCode>,IBaseCodeService
    {
        public BaseCodeServiceImpl(Repository<BaseCode> rep) : base(rep)
        {
            
        }

        public void CreateBaseCode()
        {
            _rep.Context.CodeFirst.InitTables(typeof(BaseCode));
        }

        /// <summary>
        /// 根据Code去查询单个数据
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public BaseCode QueryCode(string code)
        {
          return  this.Query(x => x.Code == code).First();
        }
    }
}