friends! I'm having a problem with getting navigation properties in WCF Data Service in WebGet method.
- I turned off ProxyCreationEnabled and LazyLoadingEnabled
- I have
[DataContractAttribute(IsReference=true)]
and[DataMember]
attributes. - I see filled properties on service side, but I don't see their on client side.
- I created usual WCF service (based on
[ServiceContract]
attribute) and in its client I saw filled properties.
What am I doing wrong? Many thanks!
If the entities are not ComplexTypes, but EntityTypes (which can be retrieved from their own collection), by default they will not be populated. You need to use:
If this doesn't work, check the version of the OData that you are implementing and of the WCF DataServices that you are using. $expand might not be implemented in WCF DataServices if you use an older version.
Also, in OData services for WebApi there is an [EnableQuery] attribute which must be added to support parameters like $expand, look for the way to enable query options on WCF DataServices.