![]() The provider will differ depending on the database you’re trying to access (e.g. This tells ORM libraries like Entity Framework which provider they should be using. ![]() Notice how there is also a “providerName”. The connectionStrings section is the place to put your connection strings to any databases you want to access. If things start to get a little more complicated, you might want to look into “Settings”, which I’ll cover later. If your needs are simple, you could be fine with this. Another issue is that there is no compile-time checking that we entered the correct key, as it is just a string. We will have to parse the value for it to be more meaningful. Yet in the above example, we’re clearly working with an integer. We can access this value by using this piece of code:Īs a side note: you will need to import the System.Configuration namespace too, by adding “using System.Configuration” at the top of your file.Ī possible problem with AppSettings is that we will get back a string. AppSettingsĪppSettings provide an easy way to access string values, based on a certain key. The most well-known sections are “appSettings” and the “connectionStrings”. ![]() You can start typing under the section and Visual Studio’s Intellisense will provide you with the possible options:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |