Esempio n. 1
0
 public Role GetRole(int id)
 {
     using (var dbContext = new AccountDbContext())
     {
         return(dbContext.Find <Role>(id));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 查询单个对象
 /// </summary>
 public Menu GetMenu(int id)
 {
     using (var dbContext = new AccountDbContext())
     {
         return(dbContext.Find <Menu>(id));
     }
 }
Esempio n. 3
0
 public virtual async Task <T> GetById(object id)
 {
     if (typeof(C) == typeof(AccountDbContext))
     {
         return(_accountdbContext.Find <T>(id));
     }
     return(null);
 }
Esempio n. 4
0
 public User GetById(object id)
 {
     return(CacheHelper.Get(string.Format("{0}_{1}", CacheKey, id), () =>
     {
         using (var dbContext = new AccountDbContext())
         {
             return dbContext.Find <User>(id);
         }
     }));
 }