c# - Does any EF extension exist which supports filtered partial updates? -
to update entity either need query , change properties or attach modified or change after attachment.
but need like:
context.myentities.updatewhere( entity => { entity.isdeleted = true; entity.deleteddate = today}, entity => entitiestodelete.contains(entity.id) && !entity.isdeleted));
i expect similar (parameterized) sql emitted:
update myentitiestable set isdeleted = 1, deleteddate = @today id in (...ids list...) , isdeleted = 0;
entityframework.extended has batch update , delete feature. github
example syntax question along lines of:
context.myentities.where(entity => entitiestodelete.contains(entity.id) && !entity.isdeleted) .update(t => new myentity { entity.isdeleted = true, entity.deleteddate = today });
Comments
Post a Comment