I've created a DLL
assembly which contains the edmx
for northwind
database.
I created a reference to that dll through linqpad and I do see the db and able to run queries.
But - I want to test the behavior of DeferredLoadingEnabled
property and I need to set it via the context variable.
eg
ctx.DeferredLoadingEnabled = false;
But how can I access ctx
?
linqpad generates it for me , and I need to access it.
In Entity Framework 5, the equivalent property is:
ctx.Configuration.LazyLoadingEnabled = false;
If you're in LINQPad, you're already in the context, so you can just say:
Configuration.LazyLoadingEnabled = false;
But when I'm copying code from Visual Studio to LINQPad, I'll often just add a line at the top so all the code works the same:
var ctx = this;
There is no DeferredLoadingEnabled
property in Entity Framework
- it is part of Linq to SQL
, not Linq to entities
(EF).
Entity Framework has deferred loading by default. The linked tables will be loaded on access or when you explicitly load them yourself or when you load them directly with the first resource (eager loading).
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