예제 #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();