Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - svcutil /dconly

 
 
Old 03-04-2006   #1 (permalink)
Damon Allison


 
 

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 SpecsSystem Spec
 

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46