コード例 #1
0
        /// <summary>
        /// 创建库。
        /// </summary>
        /// <param name="connectionConfig"></param>
        /// <returns></returns>
        public static IDatabase Create(IReadOnlyConnectionConfig connectionConfig)
        {
            if (connectionConfig is null)
            {
                throw new ArgumentNullException(nameof(connectionConfig));
            }

            var adapter = DbConnectionManager.Get(connectionConfig.ProviderName);

            if (DbConnectionType.IsAssignableFrom(adapter.DbConnectionType))
            {
                return(new DbDatabase(connectionConfig, adapter));
            }

            return(new Database(connectionConfig, adapter));
        }
コード例 #2
0
 public Database(IReadOnlyConnectionConfig connectionConfig, IDbConnectionLtsAdapter adapter)
 {
     this.connectionConfig = connectionConfig;
     this.adapter          = adapter;
     this.databaseFor      = DbConnectionManager.GetOrCreate(adapter);
 }