Linq2SQl eager load with multiple DataLoadOptions

后端 未结 3 811
无人共我
无人共我 2020-12-15 09:19

I like to fetch the data with eager-loading using Linq2SQL. The code is similar as :

       DataLoadOptions options = new DataLoadOptions();

       options.         


        
3条回答
  •  离开以前
    2020-12-15 09:59

    I hit this issue in some code too, and after much experimenting and googling it looks like LINQ can only join across a single one-to-many relationship from each table : if you try to specify more than one to pre-load it just (randomly?) picks which one to pre-load and which others to leave deferred (simply ignoring those LoadWith hints)

    Other people have posted this too, for example

    http://codebetter.com/blogs/david.hayden/archive/2007/08/06/linq-to-sql-query-tuning-appears-to-break-down-in-more-advanced-scenarios.aspx

提交回复
热议问题