예제 #1
0
        public MssqlProvider(string configName, ConfigParamSet configParams)
            : base(configName, configParams)
        {
            string version = configParams.GetParamValue("version");
            MssqlCommandFactory mssqlCommandFactory = null;

            if (!string.IsNullOrWhiteSpace(version))
            {
                string[] arr = version.Split('.');
                string   vc;
                if (arr.Length > 1)
                {
                    vc = string.Concat(arr[0].Trim(), ".", arr[1].Trim());
                }
                else
                {
                    vc = arr[0].Trim();
                }
                if (decimal.TryParse(vc, out decimal v))
                {
                    if (v >= 11)
                    {
                        mssqlCommandFactory = new MssqlCommandFactory_2012();
                    }
                    else if (v >= 10)
                    {
                        mssqlCommandFactory = new MssqlCommandFactory_2008();
                    }
                    else
                    {
                        mssqlCommandFactory = new MssqlCommandFactory();
                    }
                }
            }
            _factory = mssqlCommandFactory ?? new MssqlCommandFactory_2008();
            string strictMode = configParams.GetParamValue("strictMode");

            if (strictMode != null)
            {
                if (bool.TryParse(strictMode, out bool value))
                {
                    _factory.SetStrictMode(value);
                }
            }
        }
예제 #2
0
        public PostgreProvider(string configName, ConfigParamSet configParams)
            : base(configName, configParams)
        {
            _factory = new PostgreCommandFactory();
            var strictMode = configParams.GetParamValue("strictMode");

            if (strictMode != null)
            {
                if (bool.TryParse(strictMode, out var value))
                {
                    _factory.SetStrictMode(value);
                }
            }
        }
예제 #3
0
        public MysqlProvider(string configName, ConfigParamSet configParams)
            : base(configName, configParams)
        {
            _factory = new MysqlCommandFactory();
            string strictMode = configParams.GetParamValue("strictMode");

            if (strictMode != null)
            {
                if (bool.TryParse(strictMode, out bool value))
                {
                    _factory.SetStrictMode(value);
                }
            }
        }