Nico
Nico
CC#
Created by Nico on 7/7/2023 in #help
EF Core: Keep Copy of Entity with old state when updating
@chaos_solo I tried it and got it to work! Such a simple solution and I wasted so much time 😂 Thank you :)
14 replies
CC#
Created by Nico on 7/7/2023 in #help
EF Core: Keep Copy of Entity with old state when updating
Ah okay, thank you. I will try that
14 replies
CC#
Created by Nico on 7/7/2023 in #help
EF Core: Keep Copy of Entity with old state when updating
EF Core automatically keeps the objects' states in sync. So after updating on object, the other one will also update
14 replies
CC#
Created by Nico on 7/7/2023 in #help
EF Core: Keep Copy of Entity with old state when updating
The documentation here even says that you can ignore ReferenceLoops using Json.NET but in practice in doesn't work.. it can't seem to deal with proxies from ef core :( https://learn.microsoft.com/en-us/ef/core/querying/related-data/serialization
14 replies
CC#
Created by Nico on 7/7/2023 in #help
EF Core: Keep Copy of Entity with old state when updating
Yes, I previously tried building my own generic function using the change tracker. However, since my entities refer to each other bidirectionally, I ran into problems avoiding circular dependencies in my recursion. I found a way to handle it for one to one relationships, but eventually gave up because my solution didn't work for collections. So I would still get loops in my recursion for many to one and many to many relationships. I thought that copying the object somehow would be an easier way to implement this feature and also easier to work with
14 replies
CC#
Created by Nico on 7/7/2023 in #help
EF Core: Keep Copy of Entity with old state when updating
I want to update the entity and send an email that shows which properties of the entity changed. I use Razor-Templates to create the email at runtime and therefore need the old and the new state of the entity to fill the template with information
14 replies