tags:

views:

275

answers:

1

I have a class in my domain model called

JobPlan

this class is stored / retrieved via ORM and used on various places.

I am creating a view that shows a treelist of this class and the treelist needs this class to implement certain interface (the interface comes from a 3rd party lib). Adding the interface to the JobPlan class will however force all assemblies that use this class to reference the third party control as well. This is not ideal.

I am thinking of having a

JobPlanPresenter

that would simply inherit JobPlan and implement the methods for the interface. This would lead me to a problem of how to then get JobPlan (parent) transformed to JobPlanPresenter child. I could obviously create a transformer class that would simply copy all the fields from the parent class to the child class, but that seems as a quite ugly hack to me, that would also kill all the updates on the original objects etc.

Do you think there is another way ? Am I missing something completely ?

+1  A: 

One solution would be to just have JobPlanPresenter hold a reference to a JobPlan. Then the JobPlanPresenter is just a thing wrapper around a JobPlan with a reference to the JobPlan and the JobPlan's children JobPlanPresenter wrappers.

carson
Thank you. This is actually a neat idea. I guess I was to blinded by inheritance when thinking about the problem. Thanks again.
Tomas Pajonk