Description
Question
I'm trying to figure out how to access navigation properties when data is loaded. I've tried IMaterializationInterceptor.InitializedInstance
and ChangeTracker.Tracked
. Neither executes after applying the navigation properties. Similar questions have been asked, but I don't see any solutions that work:
In #32535, there's a suggestion for interception after the result set has been consumed. Apparently it's described somewhere at https://learn.microsoft.com/en-us/ef/core/logging-events-diagnostics/interceptors#database-interception. But they all look like intercepts that happen prior to properties being set on the objects, so that does no good.
For some context, my objects implement INotifyPropertyChanged
and I'm simply trying to wire child objects to their parents, so that the parents know when a child property has changed. I suppose everywhere that I retrieve data, I could execute code to traverse the object graph and do the wiring, but that seems like a bad way to do it.
Your code
Stack traces
Verbose output
EF Core version
9.0.3
Database provider
Microsoft.EntityFrameworkCore.SqlServer
Target framework
.NET 9.0
Operating system
Windows 10
IDE
Visual Studio Enterprise 2022 17.13.6