Mass Transit 在使用发件箱模式时不会创建表格

问题描述 投票:0回答:0

我正在尝试使用公共交通事务发件箱模式,这是配置:

程序.cs:

 services.AddMassTransit(configuration =>
            {
                configuration.AddEntityFrameworkOutbox<PersonalGoodsDbContext>(o =>
                {
                    o.QueryDelay = TimeSpan.FromSeconds(1);
                    o.UseSqlServer();
                    o.UseBusOutbox();
                });

                configuration.UsingRabbitMq((_, cfg) =>
                {
                    cfg.AutoStart = true;
                });
            });

迁移也适用:

await using (var scope = app.Services.CreateAsyncScope())
{
    var writeContext = scope.ServiceProvider.GetService<PersonalGoodsDbContext>();
    var readContext = scope.ServiceProvider.GetService<SgmsReadContext>();
    await writeContext.Database.MigrateAsync();
    var seedData = new SeedData(readContext);
    await seedData.SeedAsync();
}

和我的 dbcontext 类:


 protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfigurationsFromAssembly(typeof(CenterMapping).Assembly);
            modelBuilder.HasSequence<int>("DocumentSequenceNumber");
            modelBuilder.AddInboxStateEntity();
            modelBuilder.AddOutboxMessageEntity();
            modelBuilder.AddOutboxStateEntity();
        }

我真的不知道为什么没有通过公共交通为我创建的表(InboxState,OutboxMessage,OutboxState)

c# .net-core rabbitmq masstransit
© www.soinside.com 2019 - 2024. All rights reserved.