KevinDockx / JsonPatch

JSON Patch (JsonPatchDocument) RFC 6902 implementation for .NET
MIT License
173 stars 29 forks source link

JsonPatch and property state in EF #89

Closed catinodeh closed 5 years ago

catinodeh commented 6 years ago

After receiving the object on my WebAPI (JsonPatchDocument address) I do the following operations:

var existingBilling = await _buss.GetById(billingid); address.ApplyTo(existingBilling); _buss.Update(existingBilling, userId);

In my business layer, all I do is set the udpateddate and user like this:

        _repo.BillingAddresses.Attach(address);
        address.updatedby = userId;
        address.updateddate = DateTime.Now;

The problem here is that the property(ies) Applied are not changing their statuses to "Modified" and EntityFramework is assuming they are intact and not adding them to the Update call.

Anything I'm missing?

Michael

KevinDockx commented 5 years ago

Seems like an EF issue... have a look at #90 for an approach that works.