コード例 #1
0
ファイル: CSConfig.cs プロジェクト: BRychlik/coolstorage
        private static bool ReadCustomConfig(object config)
        {
            CSConfigSection configurationSection = config as CSConfigSection;

            if (configurationSection == null)
            {
                return(false);
            }

            _useTransactionScope = configurationSection.UseTransactionScope;

            if (configurationSection.CommandTimeout > 0)
            {
                _commandTimeout = configurationSection.CommandTimeout;
            }

            _doLogging   = configurationSection.EnableLogging;
            _logFileName = configurationSection.LogFilename;

            return(true);
        }
コード例 #2
0
            private string[] GetCustomConfig(object config, string contextName)
            {
                CSConfigSection configurationSection = config as CSConfigSection;

                if (configurationSection == null)
                {
                    return(null);
                }

                string key = (contextName == DEFAULT_CONTEXTNAME) ? configurationSection.DefaultConnection : contextName;

                if (configurationSection.Connections[key] == null)
                {
                    return(null);
                }

                var result = new string[2];

                result[0] = configurationSection.Connections[key].ProviderType;
                result[1] = System.Configuration.ConfigurationManager.ConnectionStrings[configurationSection.Connections[key].ConnectionString].ConnectionString;

                return(result);
            }