Reputation: 34152
I'm designing a website for a customer in asp.net c# and he wants to have access to some settings without having to modify the source code. For example, page meta keywords, some sms and email texts, and some numeric values. Well, these are always written in code. but I don't know where to save them to make them changeable via a panel while maintaining speed and quality.
Save them in a database? They have different datatypes; In a xml file? I think it will affect speed a lot. What would you suggest?
Upvotes: 0
Views: 125
Reputation: 62260
We normally keep small settings in appSettings of Web.config. I'm not sure it is relevant to your question.
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="mysetting" value="abcd"/>
<add key="anothersetting" value="cdef"/>
</appSettings>
</configuration>
Upvotes: 2
Reputation: 7830
One possible database solution would be to use ServiceStack.OrmLite with SQLite database. Your settings file will be the POCO. Query/Update happens in one line.
Another solution would be to use LINQ2XML - the overhead for writing & reading a small file from time to time is insignificant.
Upvotes: 0
Reputation: 8206
If the data set is small and flat (e.g. non-relational or hierarchical), I would either put the data into your App_Data.xml or Web.config file. A relational database is too much hassle for flat application settings. You can then edit the App_Data file during runtime using just the Xml libraries that come with .NET.
Upvotes: 0