Base solution for your next web application
Open Closed

Update entity without loading it #2011


User avatar
0
markovalexey created

Can I update entity using repository without previous loading? I want to just pass only Id and changed fields - can I do this? Models often contains required navigation properties, so updating model without loading all related fileds caused toDbEntityValidationException due to null required fields.


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Entity Framework does not support it as you probably know. There are some 3rd party libraries doing it. Example: <a class="postlink" href="https://github.com/loresoft/EntityFramework.Extended">https://github.com/loresoft/EntityFramework.Extended</a>

  • User Avatar
    0
    worthyvii created

    Hi, I'm also having trouble using EF.Extended because we are in a transaction scope aready

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Actually we haven't tried <a class="postlink" href="https://github.com/loresoft/EntityFramework.Extended">https://github.com/loresoft/EntityFramework.Extended</a>, maybe you can search for another library for this operation.