设置配置文件以在asp net mvc 4中存储参数的最佳方法

Gui*_*.I. 3 asp.net-mvc configuration-files asp.net-mvc-4

我正在启动Asp Net MVC4项目,因为我是从php开发中来的,我很好奇它是设置配置文件以存储我可能需要的系统名称,版本和其他参数的最佳方法.

是否有任何指导方法可以做到这一点,例如使用配置文件或数据库查询..?

CD *_*ith 5

我广泛使用web.config来处理这类事情.

<appSettings>
    ....
    <add key="SearchUserResultMaxCount" value="100" />
</appSettings>
Run Code Online (Sandbox Code Playgroud)

public static class SearchHelper
{
    /// <summary>
    /// Gets the max records for resultset from db, configurable in web.config
    /// </summary>
    /// <returns></returns>
    public static int SearchEntityResultMaxCount()
    {
        int count;
        Int32.TryParse(ConfigurationManager.AppSettings["SearchEntityResultMaxCount"], out count);
        return count;
    }
}
Run Code Online (Sandbox Code Playgroud)