示例#1
0
 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);
     }
 }
示例#2
0
        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]);
            }
        }
示例#3
0
 public static bool HasValue(SystemConfigEnum type)
 {
     return(!string.IsNullOrEmpty(CreateInstance(type).Value));
 }
示例#4
0
 public SystemConfig(SystemConfigEnum type, string value)
 {
     Type  = type;
     Value = value;
 }