示例#1
0
 public TEntity Get(string id)
 {
     try
     {
         return(Context.Set <TEntity>().Find(id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
示例#2
0
 public void Add(TEntity entity)
 {
     Context.Set <TEntity>().Add(entity);
 }
示例#3
0
 public Repository(GymContext _db)
 {
     db    = _db;
     dbSet = db.Set <T>();
 }
示例#4
0
 public TEntity Get(int id)
 {
     return(_context.Set <TEntity>().Find(id));
 }