Connection strings - what is actually being cached?
I have started ru开发者_运维技巧nning the profiler tool in VS to see the bottlenecks in my code.
In the debug mode, before I actually get to doing something, there are about 30 requests to read the connection string from the registry. There is a variety of reasons for storing the connection string in the registry and this can't be modified.
My question is how does VS deal with caching of the connectiong string? What is being cached? How often and why? Is there a way to modify caching settings?
Thank you
I'm not sure if you're talking about a website, but the web.config is cached in memory, so putting the connection string in the web.config file is efficient.
You won't get that efficiency if you use the Registry.
What are the variety of reasons for storing connection strings in the registry? I didn't know there were any...
VS is not involved at all. You mean the BCL classes. They don't do anything about caching connectionstrings. The normal practice is to get them from the Configuration, very fast.
When your app fetches them from the registry, that must be a custom action. Any caching should be done by that code.
精彩评论