Skip to content

Commit

Permalink
Call EndRequest in MVC ServiceStackController on Dispose to dispose o…
Browse files Browse the repository at this point in the history
…f IOC deps
  • Loading branch information
mythz committed Sep 13, 2015
1 parent 12070eb commit dddbe35
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ServiceStack.Mvc/ServiceStackController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,24 @@ protected virtual void PublishMessage<T>(T message)
{
ServiceStackProvider.PublishMessage(message);
}

private bool hasDisposed = false;
protected override void Dispose(bool disposing)
{
if (hasDisposed)
return;

hasDisposed = true;
base.Dispose(disposing);

if (serviceStackProvider != null)
{
serviceStackProvider.Dispose();
serviceStackProvider = null;
}
}

HostContext.AppHost.OnEndRequest(ServiceStackRequest);
}
}

public class ServiceStackJsonResult : JsonResult
Expand Down

0 comments on commit dddbe35

Please sign in to comment.