コード例 #1
0
        /// <summary>
        /// 创建 Dbs 实例
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Dbs Create(int id)
        {
            Dbs dbs;

            lock (_dbses)
            {
                if (!_dbses.TryGetValue(id, out dbs))
                {
                    dbs = new Dbs(id, DbsKind.Unspecified);
                }
            }
            return(dbs);
        }
コード例 #2
0
        private void LoadFromCofiguration(Dbs dbs)
        {
            ConnectionStringSettings css = WebConfigurationManager.ConnectionStrings[dbs.QualifiedName]
                                           ?? ConfigurationManager.ConnectionStrings[dbs.QualifiedName];

            if (css != null)
            {
                DbsProvider provider = DbsProvider.Providers.FirstOrDefault(a => string.Equals(a.Provider, css.ProviderName, StringComparison.CurrentCultureIgnoreCase) && a.Validate(css.ConnectionString));

                DbsSetting setting = new DbsSetting(dbs, provider, css.ConnectionString)
                {
                    Provider = provider
                };
                Add(setting);
            }
        }
コード例 #3
0
 /// <summary>
 /// 返回一个克隆的实例。
 /// </summary>
 /// <param name="source"></param>
 /// <param name="settings"></param>
 internal Dbs(Dbs source, ConnectionSettings settings)
     : this(source.Id, source.Kind, true)
 {
     _settings = settings;
 }
コード例 #4
0
ファイル: Setting.cs プロジェクト: radtek/BACAClient
 /// <summary>
 ///
 /// </summary>
 /// <param name="dbs"></param>
 /// <param name="provider"></param>
 public DbsSetting(Dbs dbs, DbsProvider provider)
     : this(dbs, provider, string.Empty)
 {
 }