public async Task Handle(CollectionUpdated notification) { using (var session = await _api.StartSession().ConfigureAwait(false)) { await FetchCollectionAndConvert(notification.CollectionId).ConfigureAwait(false); await session.Close().ConfigureAwait(false); } }
public override TResponseData Send <TResponseData>(IRequest <TResponseData> request) { if (!(request is IRequireApiSession)) { return(base.Send(request)); } using (var scope = _scopeFactory.StartSession().Result) { var response = base.Send(request); scope.Close().WaitAndUnwrapException(); return(response); } }