XSDジェネレータで奇妙な動作が発生しました。これはXSDのほんの一部ですXSDツールは、C#コードを生成するときに特定のプロパティ/フィールドに "Specified"を追加します。
<xs:complexType name="CoreObject">
<xs:sequence>
<xs:element name="No" type="xs:int">
<xs:annotation>
<xs:documentation>...</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
、多くの複雑な種類があります:それはCoreObjectから派生し
<xs:complexType name="StageSequenceElement" mixed="false">
<xs:complexContent>
<xs:extension base="CoreObject">
<xs:sequence>
<xs:element name="Description" type="xs:string" minOccurs="0">
<xs:annotation>
<xs:documentation>Some Doc</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="StageRef" type="ObjectReference">
<xs:annotation>
<xs:documentation>...</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="MinDuration_100ms" type="xs:int" nillable="true" minOccurs="0">
<xs:annotation>
<xs:documentation>...</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="MaxDuration_100ms" type="xs:int" nillable="true">
<xs:annotation>
<xs:documentation>...</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="StageOnDemand" type="xs:boolean" nillable="true" minOccurs="0">
<xs:annotation>
<xs:documentation>...</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
:私はこのようなXSDを得ました。
public bool MinDuration_100msSpecified
と
public bool StageOnDemandSpecified
:私は
thisに似たクラスを生成するとき
だから、私は(私が期待する5に加えて)2つのプロパティを持つ生成されたクラスを取得します
"元の"プロパティに "Specified"が追加され、タイプがboolになりました。 これはなぜだと誰も説明できますか?
ありがとうございますが、そのプロパティの作成を防止する方法はありますか? – derape
多くの機能を提供するxsd2codeツールを試すことができます。 http://xsd2code.codeplex.com/ –
私たちは私たちのニーズに合ったourselfsによってcodegenになったが、とにかく感謝している:-) – derape