PDA

View Full Version : (EDM issue) Mapping entity to XML and Sql


thezeski
23-11-2010, 12:49 PM
Hi guys



I'm writing an application that needs to map two different stores into different properties of the same entity.

Basically, we have a CMS that exposes a file list PDF's via a web service. We have to send it an XML request and the response contains the data that needs to be parsed into each entity.

I'm not sure how to modify the model in this way though. I can think of two ways to handle this,

1. Create a new Schema in the EDMX file that uses something like the System.Xml.Provider for each different request type/result set

2. Write a partial class for the Entity and populate all the unmapped fields using serialized XML

I'm actually unsure if there is a better way to go about this... so if you know one please let me know. This is my first MVC 2 project and so I'm not completely up to speed on all the concepts/best practise.



Cheers!
Paul

thezeski
24-11-2010, 09:59 AM
In case anyone wonders...

I've written it to use EDM as the main storage and a partial class adds the extra properties to each entity. I then treated created a few classes to communicate with the web service and expose the data via LINQ.... an interface for the main entities then performs a LINQ join and returns the entity the way I want.

Just thought I'd share :)

deprecated-cruelty
25-11-2010, 08:25 AM
Thanks Paul...would be interesting to see the solution as well if at all possible?

thezeski
09-12-2010, 04:41 PM
Sorry for the silence, will post something up when I get a chance to 'anonymize' the code.