You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i have REST API in my ASP.NET application and when i perform some CRUD operations i want to send notifications .
The mediator is injected to the REST method and i use Task.Run to call mediator.Publish inside the method to send notifications asynchronously (fire and forget).
The problem is that sometimes my method is ended before the notification Task is finished or started and i get ObjectDisposeException : Cannot access a disposed object. Object name : IServiceProvider.
I thought if i will register mediator as Singleton it can helps but how it can influence on other parts of the application?
Thank you.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, i have REST API in my ASP.NET application and when i perform some CRUD operations i want to send notifications .
The mediator is injected to the REST method and i use Task.Run to call mediator.Publish inside the method to send notifications asynchronously (fire and forget).
The problem is that sometimes my method is ended before the notification Task is finished or started and i get ObjectDisposeException : Cannot access a disposed object. Object name : IServiceProvider.
I thought if i will register mediator as Singleton it can helps but how it can influence on other parts of the application?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions