I have several objects as shown in the UML diagram below:
I have written a single page MVC application which handles all objects derived from the same interfce and differ in a few properties only. My model is the coverage of all possible properties.
The thing is that when I post data to DAL I must use entites, not Models. My Controller and View uses Model, but DAL methods expect either Entity A or Entity B.
Now I want to design a class to make appropriate coversions. I can make a class having methods ConvertToA() and ConvertToB() and call methods of this class. This is the most basic layout which comes to mind at first.
But is there an appropriate Design Pattern for this, or what could be the most flexible and efficient way to accomplish this task?
Regards.
Aucun commentaire:
Enregistrer un commentaire