1 / 5

Multi-Project/XSD Data Layer

Multi-Project/XSD Data Layer. DataContracts in WCF. Serialization Programming Model for WCF Similar to ISerializable (also supported by WCF) Can generate from/to WSDL/XSD using svctool Example:

Download Presentation

Multi-Project/XSD Data Layer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Multi-Project/XSD Data Layer

  2. DataContracts in WCF • Serialization Programming Model for WCF • Similar to ISerializable(also supported by WCF) • Can generate from/to WSDL/XSD using svctool • Example: • [DataContract]public class ComplexDataContract{ [DataMember] string name; [DataMember]System.Version version; [DataMember]System.IO.FileInfofileInfo; [DataMember]System.Collections.Generic.List<System.Uri> uriList; [DataMember] System.Data.SqlTypes.SqlInt32 sqlInt; [DataMember]System.Drawing.KnownColorknownColor;}

  3. Import with Import challenges • xs:import references a namespace, but also a physical document • Namespaces in .NET assembly are not bound to the physical document or XML namespace. • Import parent XSD then import chiid XSD. Duplicate types created.

  4. Solutions • SvcTool parameter /references: • Allows parent assemblies to be referenced • Searches for duplicate types • “Custom Tool” for Visual Studio • Generates code when XSD is edited • Integrates with project system

  5. Problems • SvcTool is limited: • Only supports basic types in parent element/type • boolean, byte, dateTime, decimal, double, float, int, long, short, unsignedByte, unsignedInt, unsignedLong, unsignedShort • Critical: Fails if xs:string is included • Option B: • Use XsdDataContractImporter • Would have better performance too

More Related