public override string ToString() { var installServiceBrokerChangeFeedScript = new InstallAndConfigureSqlServiceBroker( _options.ConnectionString, _options.DatabaseName, _conversationQueueName, _conversationServiceName, _options.SchemaName, _deadLetterQueueName, _deadLetterServiceName); var installChangeFeedTriggerScript = new CreateChangeFeedTrigger(_options.TableName, _conversationTriggerName, _options.ChangeFeedTriggerTypes, _conversationServiceName, _options.SchemaName); return(new CreateInstallationProcedure(_options.ConnectionString, _options.DatabaseName, _installationProcedureName, installServiceBrokerChangeFeedScript, installChangeFeedTriggerScript, _options.TableName, _options.SchemaName, _conversationTriggerName).ToString()); }
/// <summary> /// Creates the stored procedure that will create necessary database objects needed for the change feed /// </summary> /// <param name="connectionString">The SQL connection string</param> /// <param name="databaseName">The database where the install stored proc will be created</param> /// <param name="setupProcedureName">The name of the stored procedure to create</param> /// <param name="serviceBrokerConfigScript">The script which defines all SQL Service Broker related objects</param> /// <param name="changeFeedTriggerConfigScript">The script which will create the trigger responsible for writing to the QUEUE when the target <paramref name="tableName"/> changes</param> /// <param name="tableName">The target table which will be monitored for changes</param> /// <param name="schemaName">The schema to use for the various objects to be created</param> public CreateInstallationProcedure(string connectionString, string databaseName, string setupProcedureName, InstallAndConfigureSqlServiceBroker serviceBrokerConfigScript, CreateChangeFeedTrigger changeFeedTriggerConfigScript, string tableName, string schemaName, string triggerName) : base(connectionString) { if (string.IsNullOrWhiteSpace(databaseName)) { throw new ArgumentException($"'{nameof(databaseName)}' cannot be null or whitespace", nameof(databaseName)); } if (string.IsNullOrWhiteSpace(setupProcedureName)) { throw new ArgumentException($"'{nameof(setupProcedureName)}' cannot be null or whitespace", nameof(setupProcedureName)); } if (string.IsNullOrWhiteSpace(tableName)) { throw new ArgumentException($"'{nameof(tableName)}' cannot be null or whitespace", nameof(tableName)); } if (string.IsNullOrWhiteSpace(schemaName)) { throw new ArgumentException($"'{nameof(schemaName)}' cannot be null or whitespace", nameof(schemaName)); } _databaseName = databaseName; _setupProcedureName = setupProcedureName; _serviceBrokerConfigScript = serviceBrokerConfigScript ?? throw new ArgumentNullException(nameof(serviceBrokerConfigScript)); _changeFeedTriggerConfigScript = changeFeedTriggerConfigScript ?? throw new ArgumentNullException(nameof(changeFeedTriggerConfigScript)); _tableName = tableName; _schemaName = schemaName; _triggerName = triggerName; }