I use a Service Operation in WCF data service to get a object.
[WebGet]
public IQueryable<sample> GetSamples(int Id)
I can retrieve data by
http://localhost:xx/GetSamples?Id=9
Is it possible to get property of the returned object similar to
http://localhost:xx/samples(x)/property
I’ve tried http://localhost:xx/GetSamples?Id=9/property, and http://localhost:xx/GetSamples/property?Id=9 etc. Nothing works.
If Sample is a complex type then this won’t work.
If Sample is an entity type, then it will work with a small modification. Property access is only possible on a singleton result. WCF DS doesn’t know that your service operation always returns a single entity, to tell is to, add an attribute SingleResult to your service operation method. Then the first URL should work: service/GetSample/PropertyName?id=2
If the Sample is an entity type and you know the key property value (or values) then service/Samples(keypropertyvalue)/PropertyName should also work.