What is the effect of not marking navigation properties virtual for Entity Framework (v4) entities?
If I don't use lazy loading, but neglect to properly eager load, what will happen upon accessing the (not loaded) property?
Would there be any other impact outside of lazy loading, or is that the main feature that requires virtual navigation properties?
There are two effects. One is on lazy loading, which just won't work if the property is not virtual
. But lazy loading isn't always something you want.
The second is change detection. If you're using pure POCOs or are using proxies but don't make the properties virtual
, then change detection becomes more involved.
You can learn more about change detection here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With