I am trying to implement an ISO standard which by summary has the following:
- There are
operations
(like an action in MVC) - There are respective
request
andresponse
per operation - These
requests
andresponses
have correspondingXSD
's - These
XSD
's are changing per year (as per my observation)
Here are my challenges for now:
XSD
toC#
classes generation (via VS command line) are so much pain. There are certain classes likeHeader
andEnum
's which are common to theseXSD
s but are getting generated separately.I only need specific properties from each
response
, the other values will be mapped to itsresponse
as return values. Which creates a conflict because of my problem in #1mapping the header from the request to response is not straightforward because they are of different classes. Same for other classes and enum values.
I can manually map these values from
request
toresponse
of all theoperations
that I need. But now my problem is the item #4 from my summary above. TheseXSD
's are getting updates per year. I saw some considerable amount of change from last year's version to now like new values added to enum and new elements in XML.
Here are my thoughts for next action:
- Is there any
XSD
toC#
classes generator which is smart enough not to duplicate the common classes and enumerations? This will primarily solve my problem as the mapper will be easily created. But doing it manually is an issue of deadlines and also the changingXSD
's. - If #1 is not a feasible solution, I am thinking of
PropertyCopiers
which can map values from different classes. But I haven't searched of such copiers that can map nested classes (deep property copiers). I would only rely onpropertyNames
which I can say is not reliable enough and reflection is quite slow. My last resort is doing the mapper manually like:
DifferentClass1.SamePropertyName1 = DifferentClass2.SamePropertyName1
and just do another mapper again next year when the next version comes.