Interview Questions Headline Animator

Wednesday, June 03, 2009

Function Import and loading of referenced data

Why do Entity Framework Function Imports do not have eager loading? Because when you use Entity SQL or regular Object context to retrieve data, it is a live connection. So whenever you say eager loading enabled, it gets the data from the database using the live connection. But if you want to do it using Function Import, EF doesn’t know where to get the data from, since the stored procedure that the function import maps to, doesn’t get that data. Perhaps in the later versions of EF, the team might add the feature which can mix and match the object context and the stored procedure to get the required data. But as of now it is not possible.