开发者

Creating shared data transfer classes generated by svcutil /datacontractonly and used in WCF web programming model

I am creating a set of Web Services which share some common xml defined data elements. I want to separate these entities into a common schema, service 1 specific schema, service 2 specific schema etc... the service specific schemas will reference the common schema. I want to use svcutil /datacontractonly to generate classes that can be used to create and serialize these objects using the WCF web programming model. The problem I am having is that when I import the common schema into the service specific schemas the common schema entity classes are included in the code generated for the service specific classes. This causes compile errors later when a single client attempts to use the generated entity classes for two services which both use the common schema entities. Is th开发者_StackOverflow社区ere anyway to get svcutil to only include the service specific entities in the generated code? I'd just like to have a common dll which includes the common schema entities which the services may reference.


I think this is what you need (on svcutil options)

/reference:

References types in the specified assembly. When generating clients, use this option to specify assemblies that might contain types that represent the metadata being imported.

You cannot specify message contracts and XmlSerializer types using this switch.

If DateTimeOffset referenced, this type is used instead of generating a new type. If the application is written using .NET Framework 3.5, SvcUtil.exe references DateTimeOffset automatically.

Short Form: /r

here is where I found it

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜