コード例 #1
0
 public Role GetRole(int id)
 {
     using (var dbContext = new AccountDbContext())
     {
         return(dbContext.Find <Role>(id));
     }
 }
コード例 #2
0
 /// <summary>
 /// 查询单个对象
 /// </summary>
 public Menu GetMenu(int id)
 {
     using (var dbContext = new AccountDbContext())
     {
         return(dbContext.Find <Menu>(id));
     }
 }
コード例 #3
0
 public virtual async Task <T> GetById(object id)
 {
     if (typeof(C) == typeof(AccountDbContext))
     {
         return(_accountdbContext.Find <T>(id));
     }
     return(null);
 }
コード例 #4
0
ファイル: UserService.cs プロジェクト: d8q8/DotNet.Utilities
 public User GetById(object id)
 {
     return(CacheHelper.Get(string.Format("{0}_{1}", CacheKey, id), () =>
     {
         using (var dbContext = new AccountDbContext())
         {
             return dbContext.Find <User>(id);
         }
     }));
 }