Nini: Manual: "5.2 Storing configuration data in a database
If you are running an ASP.NET application then you probably have multiple users in each system. You will probably also have a bunch of user settings to edit. Most web applications are entirely configured with a database so the following is an example of using Nini along with your database.
Here's a very simple example with a SQL Server table. This can easily be adapted to any other database. Here is the structure of the database table:
CREATE TABLE UserSettings
(
UserId ID,
Settings TEXT
);
The ConfigSettings field stores a Nini configuration value. Now you can load a Nini configuration values like this:
string userId = GetUserId(); // retrieve the user id somehow
SqlCommand command = new SqlCommand('SELECT Settings FROM UserSettings WHERE ID = '
+ userId, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
if(reader.HasRows) {
reader.Read();
IConfigSource source = new XmlConfigSource(new StringReader(reader.GetString(0)));
}
reader.Close();
connection.Close();"
The more I read, the more I acquire, the more certain I am that I know nothing. -Voltaire
Subscribe to:
Post Comments (Atom)
Ramadan - What is it?
Ramadan is one of the most important and holy months in the Islamic calendar. It is a time of fasting, prayer, and spiritual reflection fo...
-
ZipStudio - A versatile Visual Studio add-in to zip up Visual Studio solutions and projects - The Code Project - C# Programming
-
TargetProcess - Agile Project Management & Bug Tracking Software | Download (Project Management Software, Project Tracking, Bug Tracking...
No comments:
Post a Comment