I have some data in my ERP that is formed in a very odd way (think a HTML field that contains many different fields, formatted in HTML that need to be pulled out using XPath).
Is the transformation of this data into the model fields the job of the repository? Or should the repository only deal with getting the records from the database and then have a service or a transformer of some sort that turns this HTML into the individual fields?
My repository returns an IList<Product>
, however this model contains all the fields that need to be filled out. If I wanted to correctly return this type, I would have to pull all the fields out of the HTML field and set them, which doesn't feel like it belongs in the repository.
I've also seen something similar where you pass in to your repository something like an IProductTransformer
.
Another option is to have separate models... one for the result of the database call and one for how I want to interact with the model in the program code.. and then map these through a transformer?