Subclassing a Custom Control when doing it right is not possible?

100 Views Asked by At

I have a stand alone custom control that is extensively deployed.

It has one public property (ClientIdentifier) and two methods (OnLoad and RenderContents)

Over the years there have been some if clauses added to handle certain client specific situations, but now I really need to subclass it. The issue is that I can't break the API.

I have full access to the code, but I can't change the call from the website.

My thinking:

Use Onload as a Factory method, creating another POCO extends interface as a private member based on the ClientIdentifier -- call it SubControl.

In RenderContents, simply past through to SubControl.RenderContents(writer)

Is this the appropriate technique?

Or is there a better idea? (other than throwing it out and starting fresh.)

0

There are 0 best solutions below