开发者

LINQ DataLoadOptions.loadwith

This is the code I have for loading my data entities.

DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<msPlaylistItem>(m => m.tbMedia);
dlo.LoadWith<tbMedia>(a => a.tbArtists);
dlo.LoadWith<msNote>(n => n.t开发者_运维知识库bMedia.msNotes);
db.LoadOptions = dlo;

dlo.LoadWith(n => n.tbMedia.msNotes); This is the line I am having a problem with. This is the error "The expression specified must be of the form p.A, where p is the parameter and A is a property or field member."

What I am trying to do is load the notes that are related to the each tbMedia object.


this is the correct line

dlo.AssociateWith <tbMedia>(t => t.msNotes.Where(n => n.MediaId == n.tbMedia.id));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜