Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

EF eager loading: How include works

$
0
0

just see the code

var company = context.Companies
                     .Include(co => co.Employees.Select(emp => emp.Employee_Car))
                     .Include(co => co.Employees.Select(emp => emp.Employee_Country))
                     .FirstOrDefault(co => co.companyID == companyID);

1) include create join operation to fetch data from multiple table ?

2) what will happen if there is no relation between two table then how include will work? throw any error ?

3) how include understand which columns will be used to join between two table ?

i read this link https://msdn.microsoft.com/en-us/library/jj574232(v=vs.113).aspx but still not very clear that how include works

please guide me.


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>