private Execute ( |
||
providerInfo | ||
connection | IDbConnection | |
transaction | IDbTransaction | |
direction | MigrationDirection | |
commandExecutor | IDbCommandExecutor | |
return | void |
private PersistedVersioning GetPersistedVersioning(IDbConnection connection, IDbTransaction transaction, IDbCommandExecutor executor) { if (_persistedVersioning == null) { var history = new History(_versioningTableName, _providerMetadata); if (!_versioningTableExists.Value) { Debug.Assert(connection != null, "At this point, an upgrade of the versioning table is requested. This always takes part of a running migration step and therefore already has an associated connection (and possibly a transaction)."); // execute the boostrap migration to create the versioning table var step = new BootstrapMigrationStep(new BootstrapMigration(_versioningTableName), _provider, _providerMetadata); step.Execute(connection, transaction, MigrationDirection.Up, executor); _versioningTableExists = new Lazy <bool>(() => true); // now, the versioning table exists } else { // load the existing entries from the versioning table IDbConnection c = connection ?? _connectionFactory.OpenConnection(_connectionInfo); try { history.Load(c, transaction); } finally { if (connection == null) // we had to open a connection ourselves { c.Dispose(); } } } _persistedVersioning = new PersistedVersioning(history); } Debug.Assert(_persistedVersioning != null); return(_persistedVersioning); }
private PersistedVersioning GetPersistedVersioning(IDbConnection connection, IDbTransaction transaction, IDbCommandExecutor executor) { if (_persistedVersioning == null) { var history = new History(_versioningTableName, _configuration.ProviderInfo.Metadata); if (!_versioningTableExists.Value) { Debug.Assert(connection != null, "At this point, an upgrade of the versioning table is requested. This always takes part of a running migration step and therefore already has an associated connection (and possibly a transaction)."); // execute the boostrap migration to create the versioning table var step = new BootstrapMigrationStep(new BootstrapMigration(_versioningTableName), null); step.Execute(_configuration.ProviderInfo, connection, transaction, MigrationDirection.Up, executor); _versioningTableExists = new Lazy<bool>(() => true); // now, the versioning table exists } else { // load the existing entries from the versioning table IDbConnection c = connection ?? _configuration.OpenConnection(); try { history.Load(c, transaction); } finally { if (connection == null) // we had to open a connection ourselves { c.Dispose(); } } } _persistedVersioning = new PersistedVersioning(history); } Debug.Assert(_persistedVersioning != null); return _persistedVersioning; }