![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | svcutil /dconly Hello, We're trying to write our code in a "contract first" style. We want to start with the .xsd files represnting our data structures and generate the [DataContract] classes from them. The process we are using is : 1. Create the customer.xsd representing our "customer" type. 2. svcutil /dconly /t:code customer.xsd 3. Create service contract that uses the generated [DataContract] code. 4. Generate the client proxy from the service using svcutil. 5. Run the client w/ the proxy. I am having two problems generating the data contract. First, everything is needed to be marked nillable. We are going to have required elements and I don't want *everything* to be nillable. Second, evidentially we cannot use facets in xsd other than enumeration. This means we cannot enforce minLength/maxLength, pattern, etc. These two problems seem rather big. Do I have options to get around these? Will /useXmlSerializer work? If so, does anyone have an example of an .xsd that uses facets and elements not marked with nillable? Thanks, Damon With the schema below, svcutil returns the error : Error: Enum type 'customer.lastNameType' in namespace 'http://vision/customer' cannot be imported. Facets other than enumeration facets are not supported. Either fix the schema to conform to [DataContract] rules or use ImportXmlType or use a different formatter <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://vision/customer" xmlns="http://vision/customer" elementFormDefault="qualified"> <xs:complexType name="customer"> <xs:sequence> <xs:element name="lastName" nillable="true"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="0" /> <xs:maxLength value="10" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="firstName" type="xs:string" nillable="true" /> <xs:element name="middleInitial" type="xs:string" nillable="true" /> <xs:element name="age" type="xs:long" nillable="true" /> </xs:sequence> </xs:complexType> <xs:element name="customer" type="customer" nillable="true" /> </xs:schema> |
My System Specs![]() |
| Thread Tools | |
| |