(Using LLBLGen 5.5.1, Adapter templates & SQL Azure)
Hi,
I'm building in the adapter.BatchSize feature to speed up some of our queries.
In our system we have an entity called "WorkingCopy" and sometimes we need a lot of these entities to work on, save them and delete them.
I've seen a great increase in speed our Save routine by using a UnitOfWork2, adding the WorkingCopyEntity's with uow.AddForSave and then set the adapter.BatchSize to 50 before doing the uow.Commit. It's 3x faster than using adapter.SaveEntityCollection !
But for the delete, it just does't work. Nothing gets deleted.
This was the original routine :
public override void Remove(IEnumerable<int> workingcopyIds)
{
using (var adapter = CreateAdapter())
{
foreach (var workingcopyId in workingcopyIds)
{
var entity = new WorkingCopyEntity(workingcopyId);
adapter.DeleteEntity(entity);
}
}
}
which works, but obviously is very slow.
I have tried both the AddForDelete or AddcollectionForDelete of the UnitOfWork, and both don't do anything :
public override void Remove(IEnumerable<int> workingcopyIds)
{
var list = workingcopyIds.ToList();
var uow = new UnitOfWork2();
EntityCollection<WorkingCopyEntity> coll = new EntityCollection<WorkingCopyEntity>();
foreach (var workingcopyId in workingcopyIds)
{
var entity = new WorkingCopyEntity(workingcopyId);
uow.AddForDelete(entity);
}
using (var adapter = CreateAdapter())
{
adapter.BatchSize = 50;
uow.Commit(adapter, true);
}
}
or
public override void Remove(IEnumerable<int> workingcopyIds)
{
var list = workingcopyIds.ToList();
var uow = new UnitOfWork2();
EntityCollection<WorkingCopyEntity> coll = new EntityCollection<WorkingCopyEntity>();
foreach (var workingcopyId in workingcopyIds)
{
var entity = new WorkingCopyEntity(workingcopyId);
coll.Add(entity);
}
uow.AddCollectionForDelete(coll);
using (var adapter = CreateAdapter())
{
adapter.BatchSize = 50;
uow.Commit(adapter, true);
}
}
It does nothing. No error, no output logging when setting the web.config value SqlServerDQE to 4 ... just nothing.
What am I doing wrong ?
Kind regards,
Sven.