Base solution for your next web application
Open Closed

Event Handling Exception #1882


User avatar
0
epgeroy created

I have a IDomainService implementation like this:

INTERFACE

public interface IAuthorizationManager : IDomainService
    {
        Task<List<AuthorizationRole>> GetAutorizationRolesByRequisitionConsumptionCenterStore(
            RequisitionConsumptionCenterStore requisitionConsumptionCenterStore, Status status);

IMPLEMENTATION

public class AuthorizationManager : DomainService, IAuthorizationManager

METHOD DECLARATION

public async Task<List<AuthorizationRole>> GetAutorizationRolesByRequisitionConsumptionCenterStore(
            RequisitionConsumptionCenterStore requisitionConsumptionCenterStore, Status

On the other hand, I have an Event handler

public class RequisitionConsumptionCenterStoreNotifier :
        IEventHandler<EntityCreatedEventData<RequisitionConsumptionCenterStoreStatus>>, ITransientDependency

Every time the the event (RequisitionConsumptionCenterStoreNotifier.NotifyOnRelease) is fired i got an "the operation cannot be completed because the DbContext has been disposed". I already tried marking the manager method as UnitOfWork, Marking the Handler method as UnitOfWork, managing unit of work manually with

"using (var uow = _unitOfWorkManager.Begin())"

and declaring manager method as virtual.

I really do not know what to do, I think that is an unit of work problem. Im open to any suggestions. Thanks in advance.


No answer yet!