Chloe icon indicating copy to clipboard operation
Chloe copied to clipboard

Delete range

Open MeisterLone opened this issue 4 years ago • 1 comments

Hi

Is there a possibility for a delete list of objects in single command/query?

MeisterLone avatar Apr 29 '20 21:04 MeisterLone

List ids = new List(); dbContext.Delete<User>(a=> ids.Contains(a.Id));

shuxinqin avatar Apr 30 '20 03:04 shuxinqin

new version: dbContext.Delete<Person>(a => !dbContext.Query<City>().IgnoreAllFilters().Select(a => a.Id).ToList().Contains(a.CityId)); /*

  • DELETE FROM [Person] WHERE NOT ([Person].[CityId] IN (SELECT [City].[Id] AS [C] FROM [City] AS [City])) */

shuxinqin avatar May 19 '23 14:05 shuxinqin