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

PostgreSql

Nuget: Shashlik.EventBus.PostgreSQL

注册PostgreSql存储

        /// <summary>
        /// 使用连接字符串初始化注册PostgreSql存储
        /// </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 AddNpgsql(
            this IEventBusBuilder eventBusBuilder,
            string connectionString,
            string? schema = null,
            string? publishTableName = null,
            string? receiveTableName = null);

        /// <summary>
        /// 使用DbContext初始化注册PostgreSql存储
        /// </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 AddNpgsql<TDbContext>(
            this IEventBusBuilder eventBusBuilder,
            string? schema = null,
            string? publishTableName = null,
            string? receiveTableName = null)
            where TDbContext : DbContext;

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

配置项

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