11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

amrameshreddy.blog.com64 CHAPTER 3 ■ EXPLORING THE WCF PROGRAMMING MODELramrameshreddy.blog.comnamespace QuickReturns.StockTrading.ExchangeService.DataContracts{[DataContract(Namespace=" http://QuickReturns")]public class Quote{[DataMember(Name="Ticker")]public string Ticker;}}[DataMember(Name="Bid")]public decimal Bid;[DataMember(Name="Ask")]public decimal Ask;[DataMember(Name="Publisher")]public string Publisher;[DataMember(Name="UpdateDateTime")]private DateTime UpdateDateTime;■Note The UpdateDateTime field is private and attributed, so it will be serialized as part of the SOAPmessages that WCF generates.To influence the data contract, the [DataContract] attribute has several parameters thathave their own functions:Name: Defines the name for the data contract, which will also be the name in the XMLschema (XSD, WSDL). The default value is the name you defined in .NET.Namespace: Defines the namespace for the data contract. Use this property to specify aparticular namespace if your type must return data that complies with a specific datacontract or XML schema.To influence the data members and to make versioning possible, you need to be aware ofseveral parameters for the [DataMember] attribute:ramrameshreddyramrameshreddyName: Defines the name for the data contract, which will also be the name in an XMLschema (XSD, WSDL). The default value is the name you defined in .NET.Namespace: Defines the namespace for the data contract. Use this property to specify aparticular namespace if your type must return data that complies with a specific datacontract or XML schema.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!