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