Support forum for ASP.NET Zero (https://aspnetzero.com/).
User avatar
By aaron
#30685
Is it the navigation property that is throwing the rogue entry for the property?

Yes, indirectly.

If that navigation property could be persisted somehow in the entity change set it would be great. In my own implementation I could cut into EntityHistoryStore.SaveAsync() and add parent properties to my Bson document.

Yes, you could do that. EntityChange has a reference to EF's EntityEntry. You can persist the navigation property as EntityPropertyChanges.
By BobIngham
#30692
Yes, you could do that. EntityChange has a reference to EF's EntityEntry. You can persist the navigation property as EntityPropertyChanges.

When I put a watch on EntityChangeSet inside EntityHistoryStore.SaveAsync(EntityChangeSet changeSet) I can see EntityEntry: (e.g. changeSet.EntityChanges[1].EntityEntry but I can not seem to read this data so I add an parentId element to the Bson document (see below).
How do I get at the data in EF's EntityEntry?

EntityChangeSet.PNG
EntityChangeSet.PNG (368.88 KiB) Viewed 14 times
User avatar
By aaron
#30698
so I add an parentId element to the Bson document (see below).

I didn't get that.

How do I get at the data in EF's EntityEntry?

Code: Select allvar plan = changeSet.EntityChanges[1].EntityEntry.As<EntityEntry>().Entity as NcCarePlan;
if (plan != null)
{
    // ...
}