private string GetValue(SystemConfigEnum type) { using (var context = LiaoxinContext.CreateContext()) { var config = (from d in context.SystemConfigs where d.Type == type select d) .FirstOrDefault(); if (config == null) { return(Default); } return(config.Value); } }
public static BaseConfig CreateInstance(SystemConfigEnum type) { lock (_cache) { if (!_cache.ContainsKey(type)) { Assembly assembly = Assembly.Load("Liaoxin.Business"); var instance = assembly.CreateInstance($"Liaoxin.Business.Config.{type.ToString()}Config") as BaseConfig; if (instance == null) { throw new ZzbException($"反射对象失败[Liaoxin.Business.Config.{type.ToString()}Config]"); } _cache.Add(type, instance); } return(_cache[type]); } }
public static bool HasValue(SystemConfigEnum type) { return(!string.IsNullOrEmpty(CreateInstance(type).Value)); }
public SystemConfig(SystemConfigEnum type, string value) { Type = type; Value = value; }