Storage.MySql - dotnet-shashlik/shashlik.eventbus GitHub Wiki
Nuget: Shashlik.EventBus.MySql
。
/// <summary>
/// 使用连接字符串初始化注册mysql存储
/// </summary>
/// <param name="service"></param>
/// <param name="connectionString">连接字符串</param>
/// <param name="publishTableName">已发布消息表名,默认eventbus_published</param>
/// <param name="receiveTableName">已接收消息表名,默认eventbus_received</param>
/// <returns></returns>
public static IEventBusBuilder AddMySql(
this IEventBusBuilder service,
string connectionString,
string? publishTableName = null,
string? receiveTableName = null);
/// <summary>
/// 使用DbContext注册mysql存储
/// </summary>
/// <param name="service"></param>
/// <param name="publishTableName">已发布消息表名,默认eventbus_published</param>
/// <param name="receiveTableName">已接收消息表名,默认eventbus_received</param>
/// <typeparam name="TDbContext">数据库上下文类型</typeparam>
/// <returns></returns>
public static IEventBusBuilder AddMySql<TDbContext>(
this IEventBusBuilder service,
string? publishTableName = null,
string? receiveTableName = null)
where TDbContext : DbContext;
/// <summary>
/// 使用MySql存储
/// </summary>
/// <param name="eventBusBuilder"></param>
/// <param name="optionsAction"></param>
/// <returns></returns>
public static IEventBusBuilder AddMySql(this IEventBusBuilder eventBusBuilder, Action<EventBusMySqlOptions>? optionsAction = null);
-
PublishedTableName
:已发布消息表名,默认值eventbus_published
。 -
ReceivedTableName
:已接收消息表名,默认值eventbus_published
。 -
DbContextType
:EF数据库上下文类型,无默认值,和ConnectionString
必须配置其中一项。 -
ConnectionString
:数据库连接字符串,无默认值,有DbContextType
参数时,此参数无效。