开发者

Under what circumstances are RIA services navigation properties loaded?

We have a Silverlight 4 client connecting to RIA services. It's based on the standard "Business Application" Silverlight application in VS 2010. The obje开发者_开发技巧cts we send to the client over RIA services are EF 4 entities that are POCO objects generated from our edmx by T4. Our RIA service is a LinqToEntitiesDomainService<> of our linq repository.

We have two Entities that share similar structure but are unrelated. Both are both have navigation property that represents a single instances of another entity. Both are retrieved using methods marked [Query]. For one entity the navigation property is always correctly populated when we try and access its value; for the other it is never populated, it always remains null (well it seems to hold an EntityRef<> object that points to a null entity). We have verified the relations in the edmx and the generated code on the client side, both seem to share the same structure, so we don’t understand why this difference in behavior is happening. Can anyone shed some light on the subject?

Many thanks,

Robert


Are you using the "[Include]" attribute and "Include" functions in one of your entities / domain services methods and not the other one? If so, this answer to a similar question might help you: If you create a DomainService, exposing an entity, can you access aggregate entities?


Cannot give any definite answer, but you could try by checking these things:

  • Is there any data in the database for the object that is null
  • Are the query parameters correct
  • Do you have a test on the server side to see that the data is available
  • Is there an attribute missing on one of the objects
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜