Hello I`ve created simple WFC DataService and connected entit model with my database. This is Database hosted on Azure
I’ve created the DB tebles added some data. I have two tables:
Category, Sign. They are in m:n relation
When I get the Sign(1) data from i receive xml like below
<link rel="edit" title="Sign" href="Sign(1)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category" type="application/atom+xml;type=feed" title="Category" href="Sign(1)/Category" />
<category term="signdictionaryModel.Sign" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:ID m:type="Edm.Int32">1</d:ID>
<d:title>A</d:title>
<d:description>Litera a</d:description>
</m:properties>
</content>
I can see from it that this object is related with some object of Category. But how can I get those objects. I know that it is related with 2 objects of Category. Do I need to make a second query to get them ?
You can either make a second query, for example ~/Sign(1)/Category (depends on the client library you’re using, there might be built in support for this).
Or if you know that you will always need the categories for each sign, then you can request them to be expanded like this: ~/Sign(1)?$expand=Category which will get you the sign and all its categories. (Again depends on the library which might support this in a nicer way than just constructing the URI by hand).