-
Notifications
You must be signed in to change notification settings - Fork 3
Lesson 3: Pulling It All Together in a Query
We're going to build on our example from Lesson 2 and construct a query from the tables we've created and the data we've imported. If you haven't already, follow the steps in Lesson 2.
You may have noticed a notation on the tables in our schema.
<xs:element name="Product" gfdata:verbs="Delete,Get,Post,Put">
<xs:complexType>
<xs:sequence>
<xs:element name="Mnemonic" type="xs:string"/>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Price" type="xs:double" />
<xs:element name="ProductId" gfdata:AutoIncrement="true" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>The verbs attribute is an instruction telling the generator what RESTful verbs to support on the controller. The generated handler for the Get verb will give a simple dump of the table. For this lesson, we're going to create a more useful view.
In the Solution Explorer right-click on the Data Model.xsd file under the Controllers sub-directory. Select Open With... and select XML (Text) Editor. This may be your default already, in which case you can just open the file for editing.
Find the description of the Orders table and remove Get verb. It should look like this.
<xs:element name="Order" gfdata:verbs="Delete,Post,Put">
<xs:complexType>
<xs:sequence>
<xs:element name="CustomerId" type="xs:int" />
<xs:element name="OrderId" gfdata:AutoIncrement="true" type="xs:int" />
<xs:element name="ProductId" type="xs:int" />
<xs:element name="Quantity" type="xs:decimal" />
</xs:sequence>
</xs:complexType>
</xs:element>