I created a ASP.NET user control, and was wanting to create a factory with a method that allowed a control to be created via several parameters.
Originally I was going to have a constructor on the user control with the parameters, but the parameters are really only provided to make creating the user control easier from some legacy code I don't want to change significantly. I decided I wanted to instead have a method in a factory class that the legacy code could use, that way I don't muddy up the interface of my user control.
The problem I have is I can't reference the user control class from the factory class(since normally you reference a user control programmatically by adding <%@ Reference Control="~/SomeControl.ascx" %>
but the factory class isn't a asp page).
On a side note I was going to have the calling page pass a reference to itself so that the factory method could call LoadControl, but I still need to be able to declare a SomeControl variable, which it cannot.
How do I create a factory for a user control?