-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
I would like to generate my own proxies for the entities returned by EF.
The particular feature I would like to be able to implement, is similar to the LazyLoading proxies. But instead of lazy loading, I want to throw exceptions when un-loaded navigational properties are accessed.
And example navigational path could be Blog => Post => Comment.
A method that takes a Post as an argument might not know if the Comments list was loaded by the query. So if the Comments property is accessed, I would want my proxy to throw an exception, if there was no Include
for that relation in the query.
Currently, the issue is that the property would just be null, which could be interpreted wrongly be the runtime code.
I looked at the LazyLoading implementation, but it seems most of the code required to do this is marked as "Internal, do not use", so I would suggest there was a supported way of doing this. (If there is, I could not find it, but would love to know)