EF Eager Loading - related tables.
Hi,
I've noticed that Linqpad recognizes foreign keys. However, does it support Entity Frameworks "Eager Loading" of related tables ?
For example, a query like Organisations.Include( p => p.PhoneNumber)
doesn't seem to work in Linqpad
Instead, I need to use a linq join.
Paul
Comments
Which version of LINQPad are you using?
The following works for me in LINQPad 6, using an automatically generated model with SQL Server and EF Core 3.1.4 (AdventureWorks):
Here's the SQL generated:
Thanks Joe,
Would you mind including the full code you used.
I'm clearly doing something wrong.
Paul
That is the full code. Click Add connection, choose Entity Framework Core (multiprovider), choose SQL Server and point it to AdventureWorks.
Then run the following query using the default language (C# Expression):
Arggghhhh ! My apologies Joe and thanks for your patience.
I completely missed that.
I ended up writing a whole EF DbContext in Linqpad - which worked fine, but was more work, than I planned.
It's been so long since I've used the Add Connection dialog, I'd forgotten about the other drivers, having dragged and dropped connections in.
Paul
No worries, enjoy the product!