Thank you very much in advance.
My projects are targeting .NET Core 2.2.
I am trying to define a service that is using Masstransit 6.2.5, which uses SAGA Machine with a SQL database.
Using this code
services.AddMassTransit(cfg =>
{
cfg.AddConsumersFromNamespaceContaining<SubmitVolunteerConsumer>(); //add consumer
cfg.AddSagaStateMachine<UserStateMachine, UserState>(typeof(UserStateMachineDefinition))
.EntityFrameworkRepository(r =>
{
r.ConcurrencyMode = ConcurrencyMode.Pessimistic;
services.AddDbContext<DbContext, UserStateDbContext>((provider, build) =>
{
build.UseSqlServer(connectionString, m =>
{
m.MigrationsAssembly(Assembly.GetExecutingAssembly().GetName().Name);
m.MigrationsHistoryTable($"__{nameof(UserStateDbContext)}");
});
});
});
cfg.AddBus(provider => RabbitMqBus.ConfigureBus(provider, false));
});
causes an issue because it requires MassTransit.EntityFrameworkCore
6.2.5 (however, this is using Microsoft.EntityFrameworkCore.Relational
(3.1.3)) which is causing an error when I am trying to call/use the DBContext
Got this error
Could not load type 'Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptionsExtensionWithDebugInfo' from assembly 'Microsoft.EntityFrameworkCore, Version=3.1.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Could you please help me find a way to use SQL Server with my Saga machine without using a Nuget that references Entity Framework Core 3.x?
By the way, here is my Dbcontext
public UserStateDbContext(DbContextOptions options)
: base(options)
{
}
protected override IEnumerable<ISagaClassMap> Configurations
{
get { yield return new UserStateMap(); }
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
IConfigurationRoot configuration = new ConfigurationBuilder()
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
.AddJsonFile("appsettings.json")
.Build();
optionsBuilder.UseSqlServer(configuration.GetConnectionString("GRPPortal"));
}