public static EntityEntry <E> RemoveDefault <E>(this IFullAuditableDbContext dbContext, E entity, bool isPhysical) where E : class { if (isPhysical) { return(dbContext.Remove(entity)); } return(dbContext.SoftDelete(entity)); }
public static async Task <EntityEntry <E> > RemoveAsyncDefault <E>(this IFullAuditableDbContext dbContext, object[] key, bool isPhysical) where E : class { var entity = await dbContext.FindAsync <E>(key); if (entity == null) { throw new KeyNotFoundException(); } if (isPhysical) { return(dbContext.Remove(entity)); } return(dbContext.SoftDelete(entity)); }