예제 #1
0
        public void Delete(TEntity entityToDelete)
        {
            dbSet = context.Set <TEntity>();
            if (context.Entry(entityToDelete).State == EntityState.Detached)
            {
                dbSet.Attach(entityToDelete);
            }
            dbSet.Remove(entityToDelete);

            context.Entry(entityToDelete).State = EntityState.Deleted;
            context.SaveChanges();
        }
예제 #2
0
 public GenericRepository(GestionEstadioContext context)
 {
     this.context = context;
     dbSet        = context.Set <TEntity>();
 }