What tools to use to generate service code from schemas (svcutil analogue), if they do not meet the DataContractSerializer requirements
We are working on SOA, both on client (Silverlight) and server (WCF) sides, but with possibility of the clients being implemented by 3rd parties (.NET, Java, etc.). We use WSDL-first approach and want our data and services interface classes (C#) to be automatically generated from schemas during build process. So we need common data classes code not being regenerated for every service for successful compilation.
I have tried the svcutil utility, trying to first create all data contract classes from XSDs with the /dataContractOnly switch, and compile them to separate class library - the first stage. And then to create each service interface code, omitting the cl开发者_StackOverflow社区asses already in the library, with the /reference switch - the second stage.
The problem is that our schemas do not meet the DataContractSerializer requirements, so svcutil cannot create data classes. Even after I used xsd utility for this purpose, I cannot use svcutil's /reference switch on the second stage, since this switch only works for DataContract classes. And this is not the case with the classes generated by xsd utility.
So, am I missing something with these tools and are there any way to use them in my situation, or are there any other tools to generate data classes and service interfaces from XSD and WSDL schemas, in case where common data types are used by several service interfaces? Or should we hardly limit ourselves with DataContract compatible schemas? What approach do you use for WSDL-first development?
Have you tried WCF.blue tool by codeplex? WSCF.blue is a toolset that facilitates the development of web services using a contract first (specifically, a schema first) approach. This is the WCF version of the orginal Web Services Contract First tool.
Also, there is a beautiful article on Contract-First development: http://msdn.microsoft.com/en-us/magazine/ee335699.aspx
Yes WSCF.Blue is a VS plugin as it ships but the source is available and so it can be rebuilt into a command line interface version like what we had to do, with little effort required I might add.
精彩评论