What are these WCF service reference files
When I add a WCF service reference in Visual Studio 2008, a directory named Service Reference\ServiceReferenceNamespace is created.
In this directory, there's files named Service.xsd, Service1.xsd, Service2.xsd, Service3.xsd and Service4.xsd. The files are not duplicates - the different files defines different types and ele开发者_C百科ments. When I first created the service refernece, there was just one file but more Service*-files have been added when I've added more DataContract and OperationContracts.
It looks a bit strange that 5 different files are generated and not just one. If I delete the service reference (and hence the directory) and then add it again, the same files are added again.
Can anyone explain why several files are created and not just one?
When you do Add Service Reference, VS first downloads the metadata -- as WSDL and XSD files -- that describes the service. These get stored in the ServiceReference directory. Then VS runs a code generation step using those files as input, producing the Reference.cs or .vb as output.
精彩评论