protected void Application_EndRequest(object sender, EventArgs e) { var uow = (UnitOfWork)this.Context.Items[UnitOfWorkKey]; Contract.Assert(uow != null); uow.Dispose(); this.Context.Items.Remove(UnitOfWorkKey); }