public static class WebConfig
{
private static IList<SystemConfigs> sysconfkeys;
static WebConfig()
{
sysconfkeys = systemconfigrep.GetAllSystemConfig();
}
private static string _SMTPPort = "";
public static string SMTPPort
{
get
{
return _SMTPPort = sysconfkeys.FirstOrDefault(e => e.metakey == "SMTPPort") != null ? sysconfkeys.FirstOrDefault(e => e.metakey == "SMTPPort").metavalue : "25";
}
}
private static string _SMTPUsername = "";
public static string SMTPUsername
{
get
{
return _SMTPUsername = sysconfkeys.FirstOrDefault(e => e.metakey == "SMTPUsername") != null ? sysconfkeys.FirstOrDefault(e => e.metakey == "SMTPUsername").metavalue : "";
}
}
}
i am using the system level variable in the above way all over my system in my views or controllers. how can i design my this class in such a way that after calling a method to execute a query i straight away call some property like this.
usage: webconfig.getallsystemconfig().LogicalPath;
webconfig.getallsystemconfig().Smtpport;