c# - svcutil.exe xsd code genereation for objects with nested arrays -


i've got , xsd use generate datacontracts wcf service. here visual represantation of xsd

xsd visual representation

when use xsd.exe generation fine , object so

    public partial class messagetype {      private messageinfotype messageinfofield;      private lottype[] lotslistfield;      /// <remarks/>     public messageinfotype messageinfo {         {             return this.messageinfofield;         }         set {             this.messageinfofield = value;         }     }      /// <remarks/>     [system.xml.serialization.xmlarrayitemattribute("lot", isnullable=false)]     public lottype[] lotslist {         {             return this.lotslistfield;         }         set {             this.lotslistfield = value;         }     } } 

and here generated code nested lot object

    public partial class lottype {      private lotgeneralinfotype lotgeneralinfofield;      private productinfotype[] productinfofield;      //other generated fields  } 

but when try generated classes via svcutil.exe command

svcutil *.xsd /dconly /ser:xmlserializer /importxmltypes 

i different result. here generated code messagetype object.

    [system.runtime.serialization.datacontractattribute(name="messagetype", namespace="http://test.me/types")] public partial class messagetype : object, system.runtime.serialization.iextensibledataobject {      private system.runtime.serialization.extensiondataobject extensiondatafield;      private messageinfotype messageinfofield;      private lotslisttype lotslistfield;      public system.runtime.serialization.extensiondataobject extensiondata     {                 {             return this.extensiondatafield;         }         set         {             this.extensiondatafield = value;         }     }      [system.runtime.serialization.datamemberattribute(isrequired=true, emitdefaultvalue=false)]     public messageinfotype messageinfo     {                 {             return this.messageinfofield;         }         set         {             this.messageinfofield = value;         }     }      [system.runtime.serialization.datamemberattribute(isrequired=true, emitdefaultvalue=false, order=1)]     public lotslisttype lotslist     {                 {             return this.lotslistfield;         }         set         {             this.lotslistfield = value;         }     } } 

it's ok nested lottype array different. represents collection kind of xml elements it. here generated code

[system.diagnostics.debuggerstepthroughattribute()]     [system.codedom.compiler.generatedcodeattribute("system.runtime.serialization", "4.0.0.0")]     [system.runtime.serialization.collectiondatacontractattribute(name="lotslisttype", namespace="http://test.me/types", itemname="lot")]     public class lotslisttype : system.collections.generic.list<lottype>     {     }      [system.diagnostics.debuggerstepthroughattribute()]     [system.codedom.compiler.generatedcodeattribute("system.runtime.serialization", "4.0.0.0")]     [system.xml.serialization.xmlschemaproviderattribute("exportschema")]     [system.xml.serialization.xmlrootattribute(isnullable=false)]     public partial class lottype : object, system.xml.serialization.ixmlserializable     {          private system.xml.xmlnode[] nodesfield;          private static system.xml.xmlqualifiedname typename = new system.xml.xmlqualifiedname("lottype", "http://test.me/types");          public system.xml.xmlnode[] nodes         {                         {                 return this.nodesfield;             }             set             {                 this.nodesfield = value;             }         }          public void readxml(system.xml.xmlreader reader)         {             this.nodesfield = system.runtime.serialization.xmlserializableservices.readnodes(reader);         }          public void writexml(system.xml.xmlwriter writer)         {             system.runtime.serialization.xmlserializableservices.writenodes(writer, this.nodes);         }          public system.xml.schema.xmlschema getschema()         {             return null;         }          public static system.xml.xmlqualifiedname exportschema(system.xml.schema.xmlschemaset schemas)         {             system.runtime.serialization.xmlserializableservices.adddefaultschema(schemas, typename);             return typename;         }     } 

is there way generated same code xsd.exe datamemeber/datacontract attributes?


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -