Skip to content

Instantly share code, notes, and snippets.

@khellang
Last active December 23, 2015 21:39
Show Gist options
  • Save khellang/6697424 to your computer and use it in GitHub Desktop.
Save khellang/6697424 to your computer and use it in GitHub Desktop.
protected override void RequestStartup(ILifetimeScope container, IPipelines pipelines, NancyContext context)
{
pipelines.AfterRequest.AddItemToEndOfPipeline(ctx =>
{
if (ctx.Response.StatusCode != HttpStatusCode.InternalServerError)
{
container.Resolve<DbContext>().SaveChanges();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment