Exemple #1
0
        /// <summary>
        ///数据库context
        /// </summary>
        /// <param name="conn">connectionStrings 配置项</param>
        public MySqlDBContext(string conn = "defconn")
        {
            //mysql数据库链接
            connection = new MySqlConnection(GetConfig.GetConnectionString(conn));
            connection.Open();

            //配置
            DapperExtensions.Config.IsEnableFalseDelele  = true;
            DapperExtensions.Config.IsEnableGlobalFilter = true;
        }
Exemple #2
0
        /// <summary>
        ///数据库context
        /// </summary>
        /// <param name="conn">connectionStrings 配置项</param>
        public SqlServerDBContext(string conn = "ssconn")
        {
            //数据库链接
            var sb = new SqlConnectionStringBuilder(GetConfig.GetConnectionString(conn))
            {
                AsynchronousProcessing = true
            }.ToString();

            connection = new SqlConnection(sb);
            connection.Open();

            //配置
            DapperExtensions.Config.IsEnableFalseDelele  = true;
            DapperExtensions.Config.IsEnableGlobalFilter = true;
        }