1

I want my NServiceBus sagas to live in a separate SQL Server schema. The autogenerated SQL scripts creating the tables for sagas do use the custom schema name but do not create the schema if it does not exist, so one has to manually create the schema beforehand.

Is this behavior by design? Is there a hook could use to include custom code creating the schema prior to execution of autogenerated SQL?

The configuration looks like this:

public EndpointConfiguration Configure(EndpointConfiguration configuration)
        {
            if (configuration == null) throw new ArgumentNullException(nameof(configuration));

            var persistence = configuration.UsePersistence<SqlPersistence>();

            persistence.SqlDialect<SqlDialect.MsSqlServer>().Schema("nsb");
            persistence.TablePrefix(string.Empty);

            persistence.ConnectionBuilder(() => new SqlConnection(_configuration.GetConnectionString("<ConnectionStringName>")));

            return configuration;
        }
Dale K
  • 25,246
  • 15
  • 42
  • 71
AunAun
  • 1,423
  • 2
  • 14
  • 25

1 Answers1

0

SQL Persister assumes that the catalog and schemas exist before the scripts are executed.