C# Linq to Sql LoadWith返回null

C# Linq to Sql LoadWith返回null,c#,linq-to-sql,C#,Linq To Sql,在我的代码中,我有: DataLoadOptions dlo = new DataLoadOptions(); dlo.LoadWith<Place>(p => p.Address); context.LoadOptions = dlo; var places = context.Places.Where(p => p.ID >= 100 && p.ID <= 200); DataLoadOptions dlo=newdataloadopt

在我的代码中,我有:

DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Place>(p => p.Address);
context.LoadOptions = dlo;

var places = context.Places.Where(p => p.ID >= 100 && p.ID <= 200);
DataLoadOptions dlo=newdataloadoptions();
dlo.LoadWith(p=>p.Address);
context.LoadOptions=dlo;

var places=context.places.Where(p=>p.ID>=100&&p.IDprobelm是关联中的子属性,当我将其更改为false时,它被设置为true,工作正常。
谢谢大家的帮助

地址是有效的导航属性吗?在其他查询中使用它时是否有效?地址是一个就地表到地址表的关联我在sql server中执行了命令,它返回想要的结果,但当我使用地址时,它显示为空。您的问题是地址(单个)为空;但此结果集中可能有多个位置,一些位置可能有地址,其他位置可能没有;您确定检查了正确的位置吗。当您将查询更改为一个确定有地址的位置的单个id时会发生什么情况|例如,p.id==121亲爱的谢谢您的重播,我尝试了此操作,但不幸的是它没有工作I think它与dbml中的表关联有关,可以吗?我的项目是asp.net