dimanche 13 décembre 2015

Which design pattern should I use for implementing this functionality

I have common base class named as 'CommonGenericSettings' written in C# which is enforcing implementation of one of it's abstract method. This class have some generic properties which are common for all other it's sub classes. Hence these sub classes will re-use those properties along with abstract method implementation of 'GetData'.

These sub-classes inheriting another boolean 'apply-Generic' filter. On Clicking this 'apply-Generic' property, these subclasses should not have the inhertance from 'CommonGenericSettings' and instead they should take all matching named properties values from 'GenericFilter' class.

For example let say I set (populated) 'GenericFilter' object from a popup. Now on creation of any subclass object 'e.g TopItems', system first should check 'apply-GenericFilter' is true on GUI. If so, system should Create object of sub-class by providing all Generic-Filter matched properties (e.g some sub-classes don't have CurrentPeriod, PrePeriod properties and some have ) values as seed. So, if 'apply-GenericFilter' is set , it should take all required values from filter otherwise it should make normal inheritance from 'CommonSettings' class.

Now I have no idea, which design pattern fits for this model?

I am attaching complete class model as diagram to let people know, how this has to be implemented in the system.

enter image description here

Aucun commentaire:

Enregistrer un commentaire