This was a question asked by one interviewer in my early interviews. The scenario was that,
an application makes use of several database providers. How one can decide which connection instance to be used at run time.
The answer lies in the question itslef. I couldn't figure it out at that time.
This can be achieved by ProviderName attribute available in ConnectionString format. Let's do it by an example.
Consider a connection string as,
Here we have ProviderName as 'System.Data.SqlClient'. The configuration can have multiple connectionStrings with different providerName values. We can retrive providerName value and can create an instance based upon it.