Modeling the data contracts

Next, we will add a data contract model, a Product data contract, and a Product Fault contract to the model.

  1. Add a Data Contract Model with the name ProductService.
  2. Add a Data Contract to the model with the name Product. This data contract should have the following data members with these data types: ProductID (Int32), ProductName (String), QuantityPerUnit (String), UnitPrice (Decimal), and Discontinued (Boolean).
  3. Add a Fault Contract to the model with the name ProductFault. This fault contract should have one data member: FaultMessage (String).

In this model, we didn't specify the unit price as type Decimal?, even though it should really be Decimal?. This is because Service Factory doesn't support nullable data types.

Also, we didn't add LastUpdateVersion as a data member, even though we need to pass this member to the client to that when the product is passed back, we can check if this product has been updated by other applications. The reason why we didn't include this data member in the model is that Service Factory doesn't support Binary data types.

We will adjust these two data members in the data contract in a later section, after we have generated the source code.

The detailed steps, and the final data contract model should be the same as described in Chapter 7. To refresh your memory, your data contract model should look like this:

Modeling the data contracts
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset