EntityFramework.Triggers
EntityFramework.Triggers copied to clipboard
question re async
Hi, love this library!
What's the right way to use async code in the trigger body? Like this pseudo-code example:
configure.Triggers<Order, dbContext>().Inserted
.Add<(IEmitter Emitter, IDepotOrderRepository OrderRepository)>(
async entry =>
{
var foo = await OrderRepository.DoSomething();
await Emitter.Emit(foo);
Console.WriteLine($"The value of foo is: {foo}");
}
);
That's pretty much it, yep. It's missing CancellationToken support for now.
So the issue I'm getting is coming from SimpleInjector. Any thoughts on how I can resolve this? Cheers!
SimpleInjector.ActivationException: DepotOrderRepository is registered using the 'Async Scoped' lifestyle, but the instance is requested outside the context of an active (Async Scoped) scope.