Storage.SqlServer - dotnet-shashlik/shashlik.eventbus GitHub Wiki

SqlServer

Nuget: Shashlik.EventBus.SqlServer

注册SqlServer存储

        /// <summary>
        /// 使用连接字符串初始化注册sqlserver存储
        /// </summary>
        /// <param name="eventBusBuilder"></param>
        /// <param name="connectionString">连接字符串</param>
        /// <param name="schema">模式,默认值eventbus</param>
        /// <param name="publishTableName">已发布数据表名,默认值published</param>
        /// <param name="receiveTableName">已接收数据表名,默认值received</param>
        /// <returns></returns>
        public static IEventBusBuilder AddSqlServer(
            this IEventBusBuilder eventBusBuilder,
            string connectionString,
            string? schema = null,
            string? publishTableName = null,
            string? receiveTableName = null);

        /// <summary>
        /// 使用DbContext初始化注册sqlserver存储
        /// </summary>
        /// <param name="eventBusBuilder"></param>
        /// <param name="schema">模式,默认值eventbus</param>
        /// <param name="publishTableName">已发布数据表名,默认值published</param>
        /// <param name="receiveTableName">已接收数据表名,默认值received</param>
        /// <typeparam name="TDbContext"></typeparam>
        /// <returns></returns>
        public static IEventBusBuilder AddSqlServer<TDbContext>(
            this IEventBusBuilder eventBusBuilder,
            string? schema = null,
            string? publishTableName = null,
            string? receiveTableName = null)
            where TDbContext : DbContext;

        /// <summary>
        /// 使用sqlserver存储
        /// </summary>
        /// <param name="eventBusBuilder"></param>
        /// <param name="optionsAction"></param>
        /// <returns></returns>
        public static IEventBusBuilder AddSqlServer(this IEventBusBuilder eventBusBuilder, Action<EventBusSqlServerOptions>? optionsAction = null);

配置项

  • Schema:数据库模式名称,默认值eventbus
  • PublishedTableName:已发布消息表名,默认值published
  • ReceivedTableName:已接收消息表名,默认值received
  • DbContextType:EF数据库上下文类型,无默认值,和ConnectionString必须配置其中一项。
  • ConnectionString:数据库连接字符串,无默认值,有DbContextType参数时,此参数无效。
⚠️ **GitHub.com Fallback** ⚠️