How can i retrieve the provider/instance name from Provider method

Topics: Enterprise Library Core, General discussion
Dec 1, 2007 at 2:06 PM
Hi,

Is there a way to do this?

FactoryInstance factoryInstance = new FactoryInstance("Provider1");

//Now when the provider is created i want to find out the name i.e. "Provider1"

class ConcreteProvider: ProviderBase
{
void A()
{
//how can i find out name i.e. "Provider1"
// I have to retrieve the "Provider1" Data form NameTypeConfigurationElementCollection
}
}

Earlier in 1.1 there was a base class which had the name i.e. ConfigurationName property, but here i couldn't find any thing of that sought. I feel there has to be a mapping b/w the provider and ProviderData which is currently being used.

Thanks,
Sumit
Dec 4, 2007 at 11:50 AM
Hi,

There is no such a reference to config since v2, so name is only available if it was set for the actual provider instance during construction.

Regards,
Fernando