Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question re async #65

Open
ericsampson opened this issue Feb 29, 2024 · 2 comments
Open

question re async #65

ericsampson opened this issue Feb 29, 2024 · 2 comments

Comments

@ericsampson
Copy link

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}");
                     }
);
@NickStrupat
Copy link
Owner

That's pretty much it, yep. It's missing CancellationToken support for now.

@ericsampson
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants