We have a set of different POCO entities which represent the domain model for the application. Now we need to come up with an xml representation compiling data from different entities which is going to be consumed by some other application. We have a reference xml as to how the final representation should look like.
Based on the above, I have two questions which primarily are with respect to best practices and optimization:
- Given a target xml structure, what is the best and recommended way to create an xml file based on data from different entities? Should i try to use xsl transform or generate target class based on xsd and use custom translations, etc.
- Since this is a part of a POC exercise, the XML conversion would be finally replaced with data persistence in a database or/and transformation to JSON objects. I was wondering if I can use some design pattern to abstract out the target implementation so that the primary code will not get impacted when the xml generation routine gets replaced with a DAL call or JSON translation code. Any ideas?