public override void Create() { using (var masterConnection = _connection.CreateMasterConnection()) { _statementExecutor.ExecuteNonQuery(masterConnection, null, CreateCreateOperations()); ClearPool(); } }
public virtual void ExecuteSqlCommand([NotNull] string sql, [NotNull] params object[] parameters) { var commandParameters = new CommandParameter[parameters.Length]; var substitutions = new object[parameters.Length]; for (var index = 0; index < parameters.Length; index++) { var parameterName = ParameterPrefix + "p" + index; var value = parameters[index]; commandParameters[index] = new CommandParameter(parameterName, value, _typeMapper.GetDefaultMapping(value)); substitutions[index] = parameterName; } _statementExecutor.ExecuteNonQuery( _connection, _connection.Transaction?.DbTransaction, new List <SqlBatch> { new SqlBatch( string.Format(sql, substitutions), commandParameters) }); }
public override void CreateTables() { var operations = _modelDiffer.GetDifferences(null, Model); var statements = _migrationsSqlGenerator.Generate(operations, Model); _executor.ExecuteNonQuery(_connection, null, statements); }
private void Execute(IEnumerable <RelationalCommand> relationalCommands) { using (var transaction = _connection.BeginTransaction()) { _executor.ExecuteNonQuery(_connection, relationalCommands); transaction.Commit(); } }
public override void CreateTables(IModel model) { Check.NotNull(model, nameof(model)); var operations = _modelDiffer.GetDifferences(null, model); var statements = _migrationSqlGenerator.Generate(operations, model); _executor.ExecuteNonQuery(_connection, null, statements); }
public virtual void ExecuteSqlCommand([NotNull] string sql, [NotNull] params object[] parameters) { Check.NotNull(sql, nameof(sql)); Check.NotNull(parameters, nameof(parameters)); _statementExecutor.ExecuteNonQuery( _connection, new[] { CreateCommand(sql, parameters) }); }
protected virtual void Execute([NotNull] IEnumerable <SqlBatch> sqlBatches, bool ensureDatabase = false) { Check.NotNull(sqlBatches, nameof(sqlBatches)); if (ensureDatabase && !_dataStoreCreator.Exists()) { _dataStoreCreator.Create(); } using (var transaction = _connection.BeginTransaction()) { _executor.ExecuteNonQuery(_connection, transaction.DbTransaction, sqlBatches); transaction.Commit(); } }