internal ConnectionContext(Options options) { _timeout = options.CommandTimeout; IsPreview = options.IsPreview; Provider = options.Provider; var connStr = options.GetConnectionString(Provider); switch (Provider) { case DatabaseProvider.SqlServer: _sql = new SqlServerStatements(options.GetMigrationsTable()); _connection = new SqlConnection(connStr); Database = new SqlConnectionStringBuilder(connStr).InitialCatalog; break; default: throw new Exception("Unsupported DatabaseProvider " + options.Provider); } if (string.IsNullOrEmpty(Database)) { throw new Exception("No database was set in the connection string."); } }
/// <summary> /// Generate a new Connection Context with the options provided /// </summary> /// <param name="options"></param> internal ConnectionContext(Options options) { timeout = options.CommandTimeout; IsPreview = options.IsPreview; Provider = options.Provider; string connStr = options.GetConnectionString(Provider); switch (Provider) { case DatabaseProvider.sqlserver: sql = new SqlServerStatements(options.GetMigrationsTable(), options.GetMigrationsTableSchema()); Connection = new SqlConnection(connStr); Database = new SqlConnectionStringBuilder(connStr).InitialCatalog; break; case DatabaseProvider.postgresql: sql = new PostgreSqlStatements(options.GetMigrationsTable(), options.GetMigrationsTableSchema()); Connection = new NpgsqlConnection(connStr); Database = new NpgsqlConnectionStringBuilder(connStr).Database; break; case DatabaseProvider.mysql: sql = new MySqlStatements(options.GetMigrationsTable(), options.GetMigrationsTableSchema()); Connection = new MySqlConnection(connStr); Database = new MySqlConnectionStringBuilder(connStr).Database; break; } if (string.IsNullOrEmpty(Database)) { throw new Exception("No database was set in the connection string."); } }
protected DbQueryGenerator(ISqlStatements sqlStatements) { Ensure.That(sqlStatements, "sqlStatements").IsNotNull(); SqlStatements = sqlStatements; SqlExpressionBuilder = new SqlExpressionBuilder(); }
/// <summary> /// Combines the current instance with a joined entity. /// </summary> public override ISqlStatements <TMainEntity> CombineWith <TSixthJoinedEntity>( ISqlStatements <TSixthJoinedEntity> joinedEntitySqlStatements) { return (new SevenEntitiesRelationshipSqlStatements <TMainEntity, TFirstJoinedEntity, TSecondJoinedEntity, TThirdJoinedEntity, TFourthJoinedEntity, TFifthJoinedEntity, TSixthJoinedEntity>(this, joinedEntitySqlStatements.SqlBuilder)); }
protected DbQueryGenerator(ISqlStatements sqlStatements, ISqlExpressionBuilder sqlExpressionBuilder) { Ensure.That(sqlStatements, "sqlStatements").IsNotNull(); Ensure.That(sqlExpressionBuilder, "sqlExpressionBuilder").IsNotNull(); SqlStatements = sqlStatements; SqlExpressionBuilder = sqlExpressionBuilder; }
protected DbQueryGenerator(ISqlStatements sqlStatements, ISqlExpressionBuilder sqlExpressionBuilder) { Ensure.That(sqlStatements, "sqlStatements").IsNotNull(); Ensure.That(sqlExpressionBuilder, "sqlExpressionBuilder").IsNotNull(); SqlStatements = sqlStatements; SqlExpressionBuilder = sqlExpressionBuilder; }
public SqlCe4ServerClient(SqlCe4ConnectionInfo connectionInfo, IConnectionManager connectionManager, ISqlStatements sqlStatements) { Ensure.That(connectionInfo, "connectionInfo").IsNotNull(); Ensure.That(connectionManager, "connectionManager").IsNotNull(); Ensure.That(sqlStatements, "sqlStatements").IsNotNull(); _connectionInfo = connectionInfo; _connectionManager = connectionManager; _sqlStatements = sqlStatements; }
public SqlDbSchemaUpserter(ISqlStatements sqlStatements) { Ensure.That(sqlStatements, "sqlStatements").IsNotNull(); StructuresDbSchemaBuilder = new SqlDbStructuresSchemaBuilder(sqlStatements); IndexesDbSchemaBuilder = new SqlDbIndexesSchemaBuilder(sqlStatements); UniquesDbSchemaBuilder = new SqlDbUniquesSchemaBuilder(sqlStatements); IndexesDbSchemaSynchronizer = new SqlDbIndexesSchemaSynchronizer(sqlStatements); UniquesDbSchemaSynchronizer = new SqlDbUniquesSchemaSynchronizer(sqlStatements); }
public SqlDbSchemaUpserter(ISqlStatements sqlStatements) { Ensure.That(sqlStatements, "sqlStatements").IsNotNull(); StructuresDbSchemaBuilder = new SqlDbStructuresSchemaBuilder(sqlStatements); IndexesDbSchemaBuilder = new SqlDbIndexesSchemaBuilder(sqlStatements); UniquesDbSchemaBuilder = new SqlDbUniquesSchemaBuilder(sqlStatements); IndexesDbSchemaSynchronizer = new SqlDbIndexesSchemaSynchronizer(sqlStatements); UniquesDbSchemaSynchronizer = new SqlDbUniquesSchemaSynchronizer(sqlStatements); }
public SqlServerClient(IAdoDriver driver, ISisoConnectionInfo connectionInfo, IConnectionManager connectionManager, ISqlStatements sqlStatements) { Ensure.That(driver, "driver").IsNotNull(); Ensure.That(connectionInfo, "connectionInfo").IsNotNull(); Ensure.That(connectionManager, "connectionManager").IsNotNull(); Ensure.That(sqlStatements, "sqlStatements").IsNotNull(); Driver = driver; ConnectionInfo = connectionInfo; ConnectionManager = connectionManager; SqlStatements = sqlStatements; }
private DbClientBase(IAdoDriver driver, IDbConnection connection, IConnectionManager connectionManager, ISqlStatements sqlStatements, bool isTransactional, IDbTransaction transaction) { Ensure.That(driver, "driver").IsNotNull(); Ensure.That(connection, "connection").IsNotNull(); Ensure.That(connectionManager, "connectionManager").IsNotNull(); Ensure.That(sqlStatements, "sqlStatements").IsNotNull(); Id = Guid.NewGuid(); Driver = driver; ConnectionManager = connectionManager; Connection = connection; SqlStatements = sqlStatements; IsTransactional = isTransactional || transaction != null; Transaction = transaction; }
protected DbSession(ISisoDatabase db) { Ensure.That(db, "db").IsNotNull(); _id = Guid.NewGuid(); _db = db; DbClient = Db.ProviderFactory.GetTransactionalDbClient(Db); ExecutionContext = new SessionExecutionContext(this); Status = SessionStatus.Active; InternalEvents = new SessionEvents(); SqlStatements = Db.ProviderFactory.GetSqlStatements(); QueryGenerator = Db.ProviderFactory.GetDbQueryGenerator(); SqlExpressionBuilder = Db.ProviderFactory.GetSqlExpressionBuilder(); _queryEngine = new DbQueryEngine(ExecutionContext, QueryGenerator); _advanced = new DbSessionAdvanced(ExecutionContext, QueryGenerator, SqlExpressionBuilder); CacheConsumeMode = CacheConsumeModes.UpdateCacheWithDbResult; }
private RelationshipSqlStatements(ISqlStatements <TEntity> mainEntitySqlStatements, GenericStatementSqlBuilder[] joinedEntitiesSqlBuilders, GenericStatementSqlBuilder newlyJoinedEntitySqlBuilder) { _mainEntitySqlStatements = mainEntitySqlStatements; var alreadyJoinedEntitiesCount = joinedEntitiesSqlBuilders?.Length ?? 0; _joinedEntitiesSqlBuilders = new GenericStatementSqlBuilder[alreadyJoinedEntitiesCount + 1]; _allEntityMappings = new EntityMapping[alreadyJoinedEntitiesCount + 2]; for (var joinedSqlBuilderIndex = 0; joinedSqlBuilderIndex < alreadyJoinedEntitiesCount; joinedSqlBuilderIndex++) { _allEntityMappings[joinedSqlBuilderIndex + 1] = joinedEntitiesSqlBuilders[joinedSqlBuilderIndex].EntityMapping; _joinedEntitiesSqlBuilders[joinedSqlBuilderIndex] = joinedEntitiesSqlBuilders[joinedSqlBuilderIndex]; } _joinedEntitiesSqlBuilders[alreadyJoinedEntitiesCount] = newlyJoinedEntitySqlBuilder; _allEntityMappings[0] = mainEntitySqlStatements.SqlBuilder.EntityMapping; _allEntityMappings[alreadyJoinedEntitiesCount + 1] = newlyJoinedEntitySqlBuilder.EntityMapping; }
protected SqlServerProviderFactory(StorageProviders storageProvider, ISqlStatements sqlStatements) { ProviderType = storageProvider; SqlStatements = sqlStatements; ConnectionManagerFn = new Lazy <IConnectionManager>(CreateConnectionManager, LazyThreadSafetyMode.ExecutionAndPublication); }
public SqlCe4DbClient(IAdoDriver driver, IDbConnection connection, IDbTransaction transaction, IConnectionManager connectionManager, ISqlStatements sqlStatements) : base(driver, connection, transaction, connectionManager, sqlStatements) { }
protected DbClientBase(IAdoDriver driver, IDbConnection connection, IDbTransaction transaction, IConnectionManager connectionManager, ISqlStatements sqlStatements) : this(driver, connection, connectionManager, sqlStatements, true, transaction) { }
public Sql2005DbClient(IAdoDriver driver, IDbConnection connection, IDbTransaction transaction, IConnectionManager connectionManager, ISqlStatements sqlStatements, IDbPipe pipe) : base(driver, connection, transaction, connectionManager, sqlStatements, pipe) { }
public SqlCe4DbClient(IAdoDriver driver, IDbConnection connection, IDbTransaction transaction, IConnectionManager connectionManager, ISqlStatements sqlStatements, IDbPipe pipe) : base(driver, connection, transaction, connectionManager, sqlStatements, pipe) { }
public SqlDbStructuresSchemaBuilder(ISqlStatements sqlStatements) { _sqlStatements = sqlStatements; }
public SqlCe4DbClient(IAdoDriver driver, ISisoConnectionInfo connectionInfo, IDbConnection connection, IDbTransaction transaction, IConnectionManager connectionManager, ISqlStatements sqlStatements) : base(driver, connectionInfo, connection, transaction, connectionManager, sqlStatements) { }
public SqlCe4DbClient(IAdoDriver driver, IDbConnection connection, IConnectionManager connectionManager, ISqlStatements sqlStatements) : base(driver, connection, connectionManager, sqlStatements) { }
public SqlDbIndexesSchemaBuilder(ISqlStatements sqlStatements) { _sqlStatements = sqlStatements; }
public Sql2008DbClient(ISisoConnectionInfo connectionInfo, bool transactional, IConnectionManager connectionManager, ISqlStatements sqlStatements) : base(connectionInfo, transactional, connectionManager, sqlStatements) { }
/// <summary> /// Default constructor /// </summary> /// <param name="mainEntitySqlStatements">Main entity SQL statement builder</param> /// <param name="joinedEntitySqlStatements">Joined entity SQL statement builder</param> public TwoEntitiesRelationshipSqlStatements(ISqlStatements <TMainEntity> mainEntitySqlStatements, GenericStatementSqlBuilder joinedEntitySqlStatements) : base(mainEntitySqlStatements, joinedEntitySqlStatements) { }
public SqlCe4ServerClient(IAdoDriver driver, SqlCe4ConnectionInfo connectionInfo, IConnectionManager connectionManager, ISqlStatements sqlStatements) : base(driver, connectionInfo, connectionManager, sqlStatements) { _connectionInfo = connectionInfo; }
public SqlCe4ServerClient(IAdoDriver driver, SqlCe4ConnectionInfo connectionInfo, IConnectionManager connectionManager, ISqlStatements sqlStatements) : base(driver, connectionInfo, connectionManager, sqlStatements) { _connectionInfo = connectionInfo; }
static SpatialSqlStatements() { Instance = new SpatialSqlStatements(); }
static SpatialSqlStatements() { Instance = new SpatialSqlStatements(); }
public Sql2005ServerClient(IAdoDriver driver, ISisoConnectionInfo connectionInfo, IConnectionManager connectionManager, ISqlStatements sqlStatements) : base(driver, connectionInfo, connectionManager, sqlStatements) {}
public SqlDbUniquesSchemaBuilder(ISqlStatements sqlStatements) { _sqlStatements = sqlStatements; }
public Sql2005ServerClient(IAdoDriver driver, ISisoConnectionInfo connectionInfo, IConnectionManager connectionManager, ISqlStatements sqlStatements) : base(driver, connectionInfo, connectionManager, sqlStatements) { }
/// <summary> /// Combines the current instance with a joined entity. /// </summary> public ISqlStatements <TEntity> CombineWith <TJoinedEntity>(ISqlStatements <TJoinedEntity> joinedEntitySqlStatements) { return(new TwoEntitiesRelationshipSqlStatements <TEntity, TJoinedEntity>(this, joinedEntitySqlStatements.SqlBuilder)); }
public SqlCe4QueryGenerator(ISqlStatements sqlStatements, ISqlExpressionBuilder sqlExpressionBuilder) : base(sqlStatements, sqlExpressionBuilder) { }
protected internal SqlServerSisoSpatial(ISessionExecutionContext executionContext) { ExecutionContext = executionContext; SqlStatements = SpatialSqlStatements.Instance; }
protected DbClientBase(IAdoDriver driver, IDbConnection connection, IConnectionManager connectionManager, ISqlStatements sqlStatements) : this(driver, connection, connectionManager, sqlStatements, false, null) { }
public SqlDbUniquesSchemaBuilder(ISqlStatements sqlStatements) { _sqlStatements = sqlStatements; }
public Sql2005QueryGenerator(ISqlStatements sqlStatements, ISqlExpressionBuilder sqlExpressionBuilder) : base(sqlStatements, sqlExpressionBuilder) {}
public SqlDbUniquesSchemaSynchronizer(ISqlStatements sqlStatements) { Ensure.That(sqlStatements, "sqlStatements").IsNotNull(); _sqlStatements = sqlStatements; }
public SqlDbIndexesSchemaBuilder(ISqlStatements sqlStatements) { _sqlStatements = sqlStatements; }
public SqlDbIndexesSchemaSynchronizer(ISqlStatements sqlStatements) { Ensure.That(sqlStatements, "sqlStatements").IsNotNull(); _sqlStatements = sqlStatements; }
/// <summary> /// Combines the current instance with a joined entity. /// </summary> public override ISqlStatements <TMainEntity> CombineWith <TSeventhJoinedEntity>( ISqlStatements <TSeventhJoinedEntity> joinedEntitySqlStatements) { throw new NotSupportedException("Only 7 entities are allowed in a relationship"); }
public Sql2005DbClient(IAdoDriver driver, IDbConnection connection, IConnectionManager connectionManager, ISqlStatements sqlStatements) : base(driver, connection, connectionManager, sqlStatements) { }
/// <summary> /// Constructor that takes as arguments the sql statements for the main entity plus a newly joined entity sql builder. /// </summary> protected RelationshipSqlStatements(ISqlStatements <TEntity> mainEntitySqlStatements, GenericStatementSqlBuilder newlyJoinedEntitySqlBuilder) : this(mainEntitySqlStatements, null, newlyJoinedEntitySqlBuilder) { }
public Sql2005DbClient(IAdoDriver driver, IDbConnection connection, IDbTransaction transaction, IConnectionManager connectionManager, ISqlStatements sqlStatements) : base(driver, connection, transaction, connectionManager, sqlStatements) { }
/// <summary> /// Combines the current instance with a joined entity. /// </summary> public abstract ISqlStatements <TEntity> CombineWith <TJoinedEntity>(ISqlStatements <TJoinedEntity> joinedEntitySqlStatements);
public SqlServerDbClient(IAdoDriver driver, IDbConnection connection, IConnectionManager connectionManager, ISqlStatements sqlStatements, IDbPipe pipe) : base(driver, connection, connectionManager, sqlStatements, pipe) { }
public SqlDbStructuresSchemaBuilder(ISqlStatements sqlStatements) { _sqlStatements = sqlStatements; }
protected SqlServerQueryGenerator(ISqlStatements sqlStatements, ISqlExpressionBuilder sqlExpressionBuilder) : base(sqlStatements, sqlExpressionBuilder) {}