Wednesday, May 02, 2007

Is there a difference when defining it in <connectionstrings> or <appSettings>?

"In ASP.NET 2.0, features, such as Session, Membership, Personalization, and Role Manager, rely on connection strings that are stored in the connectionStrings element. You can also use the connectionStrings element to store connection strings for your own applications".
Yes, it says "can" use it. And when loooking at the code above - what have I gained? Nothing...The connectionstring I have added can't be used by GUI designtime controls - since it doesn't have a providername, secondly I don't like the separation of the connstring and the dataaccesscomponent elements.

Doesn't feel right. So, in other words - I put it all in appsettings - no change for me .

So while being my personal opinion, there are sure cases when connectionstrings in appsettings still are justified. However, for the most .NET:ed solution, one maybe should use some sort of provider system instead - define the connection in and then use the providermodel for the different types of databases and have the provider point to the connectionStrings.

No comments: