How EF include works and join RRS feed

  • Question

  • User1183902823 posted

    i heard EF include do the left join to fetch data from table with one round trip. my question is how include understand which class it will use to join.

    suppose this is my model classes

    public class Department  
    	public int Id { get; set; }  
    	public string Name { get; set; }  
    	public string Location { get; set; }  
    	public virtual List<Employee> Employees { get; set; }  
    public class Employee  
        public int Id { get; set; }  
        public string FirstName { get; set; }  
        public string LastName { get; set; }  
        public string Gender { get; set; }  
        public int Salary { get; set; }  
        public virtual Department Department { get; set; }  

    now tell me when i will include department and employee by using include the how it will understand which columns of two table will be used in join.

    tell me what hint include use to understand or determine two table's columns name to perform join?


    Tuesday, December 12, 2017 8:27 AM