示例#1
0
        public async Task <TEntity> GetByIdAsync(object id)
        {
            var currentId = int.Parse(id.ToString());
            Expression <Func <TEntity, bool> > predicate = t => t.Id == currentId;

            return(await EntityContext.Set <TEntity>().FirstOrDefaultAsync(predicate));
        }
示例#2
0
 public RepositoryBase(MarvelContext context)
 {
     EntityContext = context;
     EntityDbSet   = EntityContext.Set <TEntity>();
 }
示例#3
0
 public async Task <T> GetById(int id) => await _context.Set <T>().FindAsync(id).AsTask();