I just started playing with this Utility and it looks good so far. I am testing out some bulk updates and deletes on my SQL DB. I am batch updating a Set Tree Model (Celko Tree) and I need to update each node's Left and Right values for everything to the right of the target node. The commented out code (below) is the final result I am after. However, I am testing by setting another field so I can then go to SQL Mangler to see if the bulk update worked.
I am getting this error on the code below:
The variable name '@plinq0' has already been declared. Variable names must be unique within a query batch or stored procedure.
// Get all target node IDs, shift all remaining items left and delete target node(s)...
var targetList = _db.EntityTrees.Where(a => a.lft >= entity.lft && a.rgt <= entity.rgt).Select(a => a.Id).ToList();
var shiftLeft = targetList.Count * 2;
//EFBatchOperation.For(_db, _db.EntityTrees).Where(a => a.lft > entity.lft).Update(b => b.lft, b => b.lft - shiftLeft);
//EFBatchOperation.For(_db, _db.EntityTrees).Where(a => a.rgt > entity.rgt).Update(b => b.rgt, b => b.rgt - shiftLeft);
//EFBatchOperation.For(_db, _db.EntityTrees).Where(a => targetList.Contains(a.Id)).Delete();
EFBatchOperation.For(_db, _db.EntityTrees).Where(a => a.lft > entity.lft).Update(b => b.SystemId, b => shiftLeft);
_db.SaveChanges();
Since this table has over 700,000 records, I really need the bulk update! Any help is appreciated.
I just started playing with this Utility and it looks good so far. I am testing out some bulk updates and deletes on my SQL DB. I am batch updating a Set Tree Model (Celko Tree) and I need to update each node's Left and Right values for everything to the right of the target node. The commented out code (below) is the final result I am after. However, I am testing by setting another field so I can then go to SQL Mangler to see if the bulk update worked.
I am getting this error on the code below:
Since this table has over 700,000 records, I really need the bulk update! Any help is appreciated.