public static IPipeline GetPipelineFromAppConfig() { if (Env.DataConnectionStringSettings == null) { return(null); } IPipeline pipeline; switch (Env.DataConnectionStringSettings.ProviderName) { case "Npgsql": { pipeline = new PostgreSqlEntityPipeline(); break; } case "MySql.Data.MySqlClient": { pipeline = new MySqlEntityPipeline(); break; } case "System.Data.SqlClient": { pipeline = new SqlServerEntityPipeline(); break; } case "MongoDB": { pipeline = new MongoDbEntityPipeline(Env.DataConnectionString); break; } case "Cassandra": { pipeline = new CassandraEntityPipeline(Env.DataConnectionString); break; } case "Http": { pipeline = new HttpEntityPipeline(Env.DataConnectionString); break; } case "HttpMySql": { pipeline = new HttpMySqlEntityPipeline(Env.DataConnectionString); break; } default: { pipeline = new NullPipeline(); break; } } return(pipeline); }
/// <summary> /// 从配置文件中获取默认的数据管道 /// </summary> /// <returns>数据管道</returns> public static IPipeline GetPipelineFromAppConfig(ConnectionStringSettings connectionStringSettings = null) { connectionStringSettings = connectionStringSettings == null ? Env.DataConnectionStringSettings : connectionStringSettings; if (connectionStringSettings == null) { return(null); } IPipeline pipeline; switch (connectionStringSettings.ProviderName) { case DbProviderFactories.PostgreSqlProvider: { pipeline = new PostgreSqlEntityPipeline(connectionStringSettings.ConnectionString); break; } case DbProviderFactories.MySqlProvider: { pipeline = new MySqlEntityPipeline(connectionStringSettings.ConnectionString); break; } case DbProviderFactories.SqlServerProvider: { pipeline = new SqlServerEntityPipeline(connectionStringSettings.ConnectionString); break; } case "MongoDB": { pipeline = new MongoDbEntityPipeline(connectionStringSettings.ConnectionString); break; } case "Cassandra": { pipeline = new CassandraEntityPipeline(connectionStringSettings.ConnectionString); break; } case "HttpMySql": { pipeline = new HttpMySqlEntityPipeline(); break; } default: { pipeline = new ConsolePipeline(); break; } } return(pipeline); }