Hi.. I am using 2 Tables say Person and Country.
Person
Name--Occupation--Countryid
Mark--Sales Man --1003
William--Developer--1001
Country
id--Name
1001--San Fransisco
1002--Las Vegas
1003--New York
Here the Person references Country (country id). Consider the classes are already auto generated through EntityFramework and I have
Persons and
Countries as class name to the respected tables.
Now I am getting the Persons Data thorough the following
this.ObjectContext.Persons.Where(x=>x.Countryid==1003).ToList<Persons>();
This actually returns PersonsList but PersonsList[0].Country (For example: I am getting the first element of the list here) would be null at this case.
So here I am using Includes with the above code
this.ObjectContext.Persons.Includes("Country").Where(x=>x.Countryid==1003).ToList<Persons>();
Now PersonsList[0].Country will have the data for the Country class which that person row references too.
My question is.. Are there any options where I could get this Country data with out this Includes class. ?
Because under my case if I am using this Include class it tooks 2-3 mins (because of the huge data) to process the query. This is mainly because the query generated by EntityFramework is having one more LeftOuterJoin of Country with Persons.
If I am not using the Include then it take only few seconds to process the query. Because here the LeftOuterJoin is skipped. So is there is anyway so that I can access the data of the Country class with out Include.. ??
I have tried my level best to explain this. If you couldn't get this plz feel free to ask me your doubt..
Thanks..