In linq to sql how do I include the child entity with initial query?

后端 未结 1 705
猫巷女王i
猫巷女王i 2020-12-03 18:53

I would like to be able to include a child entity with the main entity in my linq to sql query.

Public Function GetEmployees() As IEnumerable(Of Employee)
           


        
1条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 19:30

    For LINQ to SQL you can change the DataloadOptions (code example in C#):

    var dlo = new DataLoadOptions();
    dlo.LoadWith(p => p.department);
    dc.LoadOptions = dlo;
    

    ( Include() is only supported for Linq to Entities)

    0 讨论(0)
提交回复
热议问题