开发者

svcutil not generate the complextype which wrap an array of another type with /xmlserializer sometimes

开发者 https://www.devze.com 2023-02-10 09:37 出处:网络
I have a declared element \"RecordRefSet\" in the basetypes XSD; it is a container element for \"RecordRef\" elements. The \"RecordRefSet\" element is referenced in various places in a set of WSDL.

I have a declared element "RecordRefSet" in the basetypes XSD; it is a container element for "RecordRef" elements. The "RecordRefSet" element is referenced in various places in a set of WSDL.

When my first project generates code from those WSDL and XSD, the generated code includes a class called "RecordRefSet", which is used in various places.

But when my second project generates code from a subset of those WSDL and XSD, the generated code does not include a class called "Record开发者_开发百科RefSet" and instead directly uses arrays of "RecordRef" in the places where the first project uses instances of "RecordRefSet" class.

I want to know what determines when SVCUTIL decides to generate the "RecordRefSet" class and when it decides to use arrays of "RecordRef" directly.

I have checked that it is running the exact same version of SVCUTIL, with the same command-line options (generate service contracts, XMLSerializer), in both cases. The only difference is that the first project includes all my WSDL and XSD files, generating a larger total amount of code, the second project use a subset of WSDL and XSD files.


I don't know the exact details of SvcUtil but if you add the [KnownType(typeof(YourType)] attribute to your class this will tell the proxy generator what types is the service using and according to that it should generate the RecordRefSet class for you everytime

0

精彩评论

暂无评论...
验证码 换一张
取 消