How can I delete a list of entities, without using a loop, in ASP.NET Boilerplate MVC?
Currently, I use:
foreach (var data in sampleDataList)
{
_iRepositorySampleData.Delete(data);
}
But I don't want to use a loop to delete multiple entities.
ASP.NET Boilerplate's IRepository
does not provide RemoveRange
out-of-the-box as:
ASP.NET Boilerplate is designed to be independent from a particular ORM (Object/Relational Mapping) framework or another technique to access a database.1
Feature requests in the backlog:
At the moment, there is not much going for it as it's already possible, so there is little value added.
// using Abp.EntityFrameworkCore.Repositories;
repository.GetDbContext().RemoveRange(sampleDataList);
// using Abp.EntityFramework.Repositories;
var type = sampleDataList.GetType().GetGenericArguments().Single();
repository.GetDbContext().Set(type).RemoveRange(sampleDataList);