I'd like to be able to generate individual classes (one class per file) for each Data Contract or XML type in a WCF Web Service.
I've read the svcutil documentation, and unless I skimmed a little too fast, it doesn't look like the tool supports this behaviour.
The reason I want to do this is simple - I'm trying to isolate the service's "model" from the service itself. There are several components that rely on types from the service, but don't care about the details of service-level operations such as loading/saving. I don't like the fact that these components need to take on dependencies to the same assembly that contains all sorts of invocation and binding logic.
I know that svcutil
(and the VS integration) can be configured to use pre-existing model classes in another assembly. This is a chicken-and-egg problem though; I don't really want to have to write 50 classes by hand that are (at least for now) almost identical to the generated classes. And of course I have to add all the DataContract
attributes with namespaces and other WCF attributes... it's a pain.
My ultimate aim is to actually have a presentation/domain model that's completely independent of the service model, but I don't really have the cycles for that yet. I think that generating a faux-model that can eventually be molded into a genuine presentation model would be a good, quick and easy way to start down this path. After that, I can configure the service references to use the separately-generated proxy classes and begin fleshing out something more robust.
Can this be done? Are there options for svcutil
that will get it to generate one class per file? Or is there another tool that can do it?