views:

123

answers:

3

Hi,

Are there any performance implications with using the provider pattern?

Does it rely on reflection for each instantiation or anything?

+5  A: 

Yes, the provider model usually involves a small amount of reflection, and therefore, there is going to be a little bit of a performance hit, however, it is only in the instantiation of the provider object. Once the object is instantiated, it is accessed as normal (usually via an interface). The performance versus a hard-coded model should have very little difference, but the gain you get from the programming perspective far outweighs any performance penalty. Assuming the provider actually may change one day. If not, just hard-code it.

Robert C. Barth
A: 

For detailed info please check the following link

http://msdn.microsoft.com/en-us/library/aa479030.aspx

Fahad
+1  A: 

Providers are instanced once per app-domain. Although newing up an object via reflection is slower than doing it inline, it is still very, very fast. I would say there is no performance concern for most business apps.

Daniel Auger