Search code examples
c#entity-framework-6entity-framework-plus

Can I Batch Update protected properties and classes using Entity Framework Plus?


Is there any way to do batch updates using Entity Framework Plus (and EF6) on protected (or even private) properties?

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 (as documented here) :

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.

Is there any way to perform a bulk update without making those fields public?


Solution

  • Disclaimer: I'm the owner of the project Entity Framework Plus

    No, there is currently no way of doing it.

    However, we plan to eventually support dictionary (PropertyName, Value). It's something that could work for you?

    If yes, I recommend you to post this request on our Issue Tracker and reference this SO question on it: https://github.com/zzzprojects/EntityFramework-Plus/issues

    (It will be easier for us to follow the issue on GitHub since SO is not done for this)