事务性发件箱模式

This commit is contained in:
administrator committed 2025-03-28 22:27:12 +08:00
1 parent 8da853a351
commit f007572e7f
30 files changed
+978 -135

No files matched your search

@@ -0,0 +1,20 @@
// Copyright (c) HelloShop Corporation. All rights reserved.
// See the license file in the project root for more information.
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System.Diagnostics.CodeAnalysis;
namespace HelloShop.EventBus.Logging
{
public static class DistributedEventLogExtensions
{
public static void UseDistributedEventLogs(this ModelBuilder builder) => builder.ApplyConfiguration(new EventLogEntityTypeConfiguration());
public static IServiceCollection AddDistributedEventLogs<TContext>([NotNull] this IServiceCollection services) where TContext : DbContext
{
services.AddTransient<IDistributedEventLogService, DistributedEventLogService<TContext>>().AddHostedService<DistributedEventWorker>();
return services;
}
}
}