/// <summary>
 /// 将对设置的修改持久化到数据库
 /// </summary>
 /// <param name="db">数据库连接对象</param>
 public void Save(IModelToDbContextOfBase db)
 {
     this.details.ForEach(detail =>
         {
             SettingDetail sd = db.SettingDetails.FirstOrDefault(x => x.Key == detail.Key);
             if (sd != null)
             {
                 sd.Value = detail.Value;
             }
             else
             {
                 db.SettingDetails.Add(detail);
             }
         });
     db.SaveChanges();
 }
 /// <summary>
 /// 获取一个新的系统设置的副本
 /// </summary>
 /// <param name="db">数据库连接项目</param>
 public SettingBase(IModelToDbContextOfBase db)
 {
     Type classType = this.GetType();
     Dictionary<string, PropertyInfo> properties = new Dictionary<string, PropertyInfo>();
     List<string> keys = classType.GetProperties()
         .Where(x => x.CanRead)
         .ToList()
         .ConvertAll(property =>
         {
             string key = string.Format("[{0}]{1}", classType.FullName, property.Name);
             properties.Add(key, property);
             return key;
         });
     List<SettingDetail> sds = db.SettingDetails.Where(x => keys.Contains(x.Key)).ToList();
     keys.Where(key => !sds.Any(sd => sd.Key == key)).ToList()
         .ForEach(key =>
         {
             string value = properties[key].GetValue(this).ToString();
             SettingDetail sd = new SettingDetail(key, value);
             sds.Add(sd);
         });
     this.details = sds;
 }
        /// <summary>
        /// 实例化一个彩票相关的系统设置
        /// </summary>
        /// <param name="db">数据库连接对象</param>
        public SettingOfLottery(IModelToDbContextOfBase db)
            : base(db)
        {

        }
 /// <summary>
 /// 获取用户模块的系统设置
 /// </summary>
 /// <param name="db">数据库连接对象</param>
 /// <returns>返回用户模块的系统设置</returns>
 public NormalResult<SettingOfAuthorExport> GetSettingOfAuthor(IModelToDbContextOfBase db)
 {
     SettingOfAuthor settingOfAuthor = new SettingOfAuthor(db);
     SettingOfAuthorExport info = new SettingOfAuthorExport(settingOfAuthor);
     return new NormalResult<SettingOfAuthorExport>(info);
 }
        /// <summary>
        /// 获取一个用户相关的系统设置的副本
        /// </summary>
        /// <param name="db">数据库连接对象</param>
        public SettingOfAuthor(IModelToDbContextOfBase db)
            : base(db)
        {

        }