示例#1
0
        /// <summary>
        /// 静态构造器
        /// </summary>
        static MySqlLogger()
        {
            string connectionString = null;

            #region # 验证

            if (!string.IsNullOrWhiteSpace(AopSection.Setting.ConnectionString.Name))
            {
                connectionString = ConfigurationManager.ConnectionStrings[AopSection.Setting.ConnectionString.Name]?.ConnectionString;
            }
            if (string.IsNullOrWhiteSpace(connectionString))
            {
                connectionString = AopSection.Setting.ConnectionString.Value;
            }
            if (string.IsNullOrWhiteSpace(connectionString))
            {
                throw new NullReferenceException("连接字符串未配置!");
            }

            #endregion

            //初始化SQL工具
            _SqlHelper = new SD.Toolkits.Sql.MySql.MySqlHelper(connectionString);

            //初始化日志数据表
            InitTable();
        }
示例#2
0
 /// <summary>
 /// 静态构造器
 /// </summary>
 static ExceptionLogRepository()
 {
     //初始化SQL工具
     _MySqlHelper = new SD.Toolkits.Sql.MySql.MySqlHelper(GlobalSetting.ReadConnectionString);
 }