I have a component which has a collection of objects (DataProviders). Each DataProvider has a unique name set by the user at design time. How can I make the designer generate a class into an additional file which contains the names of the DataProviders?
namespace MyNamespace
{
public class DpContainer : Component
{
public DataProviderCollection collection = new DataProviderCollection();
private void InitializeComponent()
{
DataProvider dataprovider1 = new DataProvider();
dataprovider1.Name = "Provider 1";
DataProvider dataprovider2 = new DataProvider();
dataprovider2.Name = "Provider 2";
collection.add(dataProvider1);
collection.add(dataProvider2);
}
}
}
The generated class should look like this:
namespace DataProviderNamespace
{
public class DataProviderNames
{
public const string Provider1 = "Provider 1";
public const string Provider2 = "Provider 2";
}
}
I would like to add this class as a designer.cs file. Using CodeDom I am able to create this class, but unfortunetly i have to specify full path of file. Additionally I would like to make the class partial. How can I do this?