![]() ![]() Like Entity Framework where connection string names can be referenced when creating the context: public class DatabaseContext : DbContext Clever things happen when database vendors or ORMs built-in support for the connectionStrings element. The configuration looks similar to this: įetching the connection string is done using the ConfigurationManager class: string conn = Īt first glance, this looks like a more complicated version of ConfigurationManager.AppSettings and when used this way, it actually is. ![]() The element works a bit like appSettings where you can add one or more connection strings for your application to use on runtime. Inside the web.config file (and app.config file too), there's a root element named connectionStrings. Let me start this post by providing an example to make sure that everyone follows. So, should you keep specifying connection strings using the connectionStrings element in web.config? Stay tuned to learn everything there is to learn about the subject. The times were you would just remote desktop to production and change settings inside your ASP.NET web.config file is long gone. Connection strings in web.config can be both powerful and challenging. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |