Batch Update protected properties and classes
Batch Update protected properties and classes
It would be nice to be able to do batch updates on protected (or private) properties and classes.
For example, say we have a Planet entity:
public class Planet
{
protected Planet() { }
public string Status { get; protected set; }
}
I would like to run something like this:
respository
.Query<Planet>()
.Where(x => x.Status == "LAME")
.Update(x => new Planet { Status = "AWESOME" });
... but I can't because Planet and Status are inaccessible to their protection level.
reference to stack overflow question: https://stackoverflow.com/questions/58329653/can-i-batch-update-protected-properties-and-classes-using-entity-framework-plus/58340886#58340886
Hello @dochoffiday ,
Thank you for reporting, we will look at it very soon to make it works with either a dictionary and/or an anonymous type
respository
.Query<Planet>()
.Where(x => x.Status == "LAME")
.Update(x => new { Status = "AWESOME" });
respository
.Query<Planet>()
.Where(x => x.Status == "LAME")
.Update(dict);
Best Regards,
Jonathan
Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework Extensions • Entity Framework Classic • Bulk Operations • Dapper Plus
Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval Function • SQL Eval Function
Hello @dochoffiday ,
Just to let you know, the feature is now available in EF Extensions. You can now use anonymous type in the UpdateFromQuery part.
We are currently merging both codes (Batch Update from EF Plus and EF Extensions) together. So it should be soon available on EF Plus as well. We try hard to make it happen for next week.