开发者

linq to sql xml mapping not querying across relationships without using EntitySet/EntityRef

I generated an xml mapping using MsOrmCodeGen and I am using it in an app.

I verif开发者_开发百科ied the mappings to my POCO and all looked fine. However, I am not able to query accross relationships. I then added EntitySet and EntityRef to the POCOs.

I am now able to query across relationships though now in my view I get an error stating "The type 'System.Data.Linq.EntitySet`1' is defined in an assembly that is not referenced". I fix the error by adding the reference to the assembly, though now I am a bit confused.

The reason for using POCOs and the XML mapping was to ensure that my entity classes were clean and make them persistence ignorant. How do I get the mapping to work without the EntitySet and EntityRef?


So after some investigation I found that in order to load related data so you don't need EntitySet/EntityRef. Youn need to use the DataLoadOptions class for the Datacontext.

http://msdn.microsoft.com/en-us/library/system.data.linq.dataloadoptions.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜