开发者

Is it possible?

We are thinking of moving some of the 'hard coded' settings out of our windows forms application and storing them in the sql database in a table called App_Settings. The reason for this is we have values currently hard coded into appsettings and app.config which can change over time, and it is much easier and faster to update the values in a database table than it is to update, build and deploy the app over three servers.

Please 开发者_如何学Gocan someone advise on this, and also how can we load the settings into the app and then have them readily available in any class?

Cheers Richard


Have a look at this similar thread: Resources/App.config or Database where is the best place to application strings

When you want to store settings in the database i would implement the class as Singleton or at least as a Class with only static/shared members and a factory method(getAppSettings)which returns that single/static instance. So you could access your settings from everywhere and it is only initialized once.


Why don't you use something like YAML to save these settings? It would be easy to create a form to edit and save these settings in a file, instead of a db (which would add more maintainance problems).

Otherwise, I would suggest to use something like NHibernate to use a database, and SQLLite as the db server.

Also, note that if you are updating these settings, I would not say that these are App_Settings, since App_Settings aren't usually modifyable without

Help this helps, Pietro

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜