Closed OwnageIsMagic closed 4 days ago
Yeah, sorry, you can no longer do that after we switched to using ServiceProvider
as a default. Pretty sure this is documented. Guess we can make the docs call it out a little clearer, or catch & rethrow a more explanatory exception.
You can modify the Wolverine configuration, but not make any new service registrations
https://wolverine.netlify.app/guide/durability/efcore.html examples shows that method, but don't mention that it's required when using AddDbContextWithWolverineIntegration
and removing it results in not friendly exception. Any reason why AddDbContextWithWolverineIntegration
can't apply EntityFrameworkCoreBackedPersistence
inline?
It's apparently a bug. I think the test harnesses might still be using Lamar so this didn't get caught.
At some point the root cause is just me not being omniscient, and it's something that got missed. Admittedly, Wolverine is much more commonly used with Marten and the EF Core integration doesn't always keep up. Something I'd like to see improved greatly next year.
AddDbContextWithWolverineIntegration
is callingservices.AddSingleton<IWolverineExtension, EntityFrameworkCoreBackedPersistence>();
HostBuilderExtensions.AddWolverine
is callingand
EntityFrameworkCoreBackedPersistence
containsthats reults in
'System.InvalidOperationException' in Microsoft.Extensions.DependencyInjection.Abstractions.dll: 'The service collection cannot be modified because it is read-only.'
IWolverineExtension
resloved from DI, can't modify DI container.It's can be resolved by explicitly calling
UseEntityFrameworkCoreTransactions
which applies this extension inline.