pipeline behaviour calling scoped object is loosing its state
mweel1 opened this issue · comments
Basically have this use case.
A scoped class takes gets actions addd to a list during various processes in MediatR handlers.
A pipleine behaviour calles the Run() method of the scoped class.
The run method of the scoped class takes the list and runs the actions
The problem is when I call this scoped class from a MediatR pipeline the state of the object is always empty.
Here is how I add "state" object.
builder.Services.AddScoped<IntegrationEventService, IntegrationEventService>();
Here is how I add my behaviour
builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(IntegrationBehaviour<,>));
I tried switching the pipeline to scoped, but that didn't work either.
Basically I am trying to add a bunch of domain events and then have those get triggered in a queue once the application layer has done all its work.
Any help would be appreciate, and thank you in advance.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
This issue was closed because it has been stalled for 14 days with no activity.