Skip to content

Instantly share code, notes, and snippets.

@bvanderveen
bvanderveen / Rx.cs
Created December 22, 2010 02:29
Examples of wrapping an APM operation using the Reactive Framework and the Task Parallel Library
using System;
using System.Disposables;
using System.IO;
using System.Linq;
using System.Threading;
namespace RxVsTplSamples
{
public static partial class Extensions
{
@bvanderveen
bvanderveen / TransformMiddleware.cs
Created December 19, 2010 05:36
An IApplication which transforms requests/responses to/from a wrapped IApplication
// this snippet assumes the IAsyncResult implementation provided here:
// http://msdn.microsoft.com/en-us/magazine/cc163467.aspx
using System;
using Owin;
namespace TransformMiddleware
{
// Defines a tranformation of an HTTP context.
public interface IHttpTransform
public interface IApplication {
// either may throw exception
IAsyncResult BeginInvoke(IRequest request, AsyncCallback callback, object state);
IResponse EndInvoke(IAsyncResult result);
}