1
데이터베이스에서 설정을 읽는 응용 프로그램 전체 유틸리티/관리자 클래스를 어떻게 작성해야합니까? 정적 클래스를 사용해야합니까?asp.net mvc 유틸리티/관리자 클래스를 만들고 저장하는 올바른 방법
public static class ThemeHelper
{
private static string themeDirectory { get; private set; }
static ThemeHelper()
{
// read from the database
themeDirectory = "blue-theme";
}
public static string ResolveViewPath(string viewName)
{
string path = string.Format("~/themes/{0}/{1}.aspx", themeDirectory, viewName);
// check if file exists...
// if not, use default
return path;
}
}
또는 HttpApplicationState에 저장된 일반 클래스의 정적 인스턴스 예를 들어? 또는 의존성 삽입 라이브러리 (예 : Ninject)를 사용해야합니까?