LINQ DataLoadOptions.loadwith
这是我用来加载数据实体的代码LINQ DataLoadOptions.loadwith,linq,Linq,这是我用来加载数据实体的代码 DataLoadOptions dlo = new DataLoadOptions(); dlo.LoadWith<msPlaylistItem>(m => m.tbMedia); dlo.LoadWith<tbMedia>(a => a.tbArtists); dlo.LoadWith<msNote>(n => n.tbMedia.msNotes); db.LoadOptions = dlo; DataLoa
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<msPlaylistItem>(m => m.tbMedia);
dlo.LoadWith<tbMedia>(a => a.tbArtists);
dlo.LoadWith<msNote>(n => n.tbMedia.msNotes);
db.LoadOptions = dlo;
DataLoadOptions dlo=newdataloadoptions();
dlo.LoadWith(m=>m.tbMedia);
dlo.LoadWith(a=>a.tb);
dlo.LoadWith(n=>n.tbMedia.msNotes);
db.LoadOptions=dlo;
dlo.LoadWith(n=>n.tbMedia.msNotes)这是我遇到问题的线路。这是错误“指定的表达式的形式必须是p.A,其中p是参数,A是属性或字段成员。”
我要做的是加载与每个tbMedia对象相关的注释。这是正确的一行
dlo.AssociateWith <tbMedia>(t => t.msNotes.Where(n => n.MediaId == n.tbMedia.id));
dlo.AssociateWith(t=>t.msNotes.Where(n=>n.MediaId==n.tbMedia.id));
我做了这个更改,得到了相同的错误dlo.LoadWith(t=>t.msNotes.Where(n=>n.MediaId==n.tbMedia.id));