NServiceBus不会自动创建架构(SQL Server)

时间:2020-02-26 07:53:15

标签: sql-server nservicebus nservicebus-sagas

我希望我的NServiceBus sagas驻留在单独的SQL Server架构中。为sagas创建表的自动生成的SQL脚本确实使用了自定义模式名称,但是如果该模式名称不存在,则不会创建该模式,因此必须事先手动创建模式。

这是设计使然吗?是否有一个钩子可以用来包含在执行自动生成的SQL之前创建架构的自定义代码?

配置如下:

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;
        }

1 个答案:

答案 0 :(得分:0)

SQL Persister假定目录和架构在执行脚本之前就已经存在。

相关问题