This project is read-only.

Project Description

Proxi (Proxy Interface) is a light-weight library that offers a common interface for generating proxies at runtime (aka dynamic proxies). Making possible for developers to leverage runtime proxy generation without having to couple their frameworks, libraries or applications to an specific implementation.

Utilize Proxi to generate runtime-built proxies is not really different from using a proxy provider. In fact, Proxi has a seamless and modern API that can help to make the process of creating proxies simpler and more intuitive.

Supported Proxy Providers

Implementation Version
Castle Dynamic Proxy 2.1
Spring.NET 1.3
LinFu 1.0
Unity Pending

Why Proxi?

This project is an effort to...
  • Improve flexibility and adaptability. Ideally frameworks and libraries should not impose the use of a proxy provider to the applications that are built on top of them. By utilizing Proxi frameworks and libraries can delegate the decision of choosing or changing a proxy provider to final applications.
  • Minimize the impact of making a mistake. It is commonly a bigger problem not to be prepared to reverse a wrong decision than the wrong decision itself. Proxi aims to keep your proxy provider decoupled from your application making easy to change it at any time.

How does Proxi compare to a proxy provider?

From an application standpoint, Proxi can be understood as a proxy provider. It has an API that is relatively similar to some proxy provider APIs. However, technically, Proxi should be defined as a common interface that meditates the communication between an application and its proxy provider.

How easy is to replace a proxy provider?

Proxi can abstract out the idea of having a proxy provider to the point where it is even possible to replace it without having to compile again.

What do I need to utilize Proxi?

  1. Download the latest release from this website.
  2. Select 'Add Reference...' on your Visual Studio project.
  3. Locate and select Proxi.dll.

Where can I get proxy providers?

Proxi distribution includes a binary version and licenses of all supported proxy providers.

Where can I get the source code for this project?

You can get it from here.

Quick Overview

How to choose a proxy provider?

var factory = new ProxyFactory(ProxyBehavior.YourProxyProvider); // [Spring|Castle|LinFu]

How to create a method interceptor?

class NullArgumentInterceptor : IInterceptor
	public object Run(IMethodInvocation mi)
		if (mi.Arguments.Any(a => a == null)) throw new ArgumentNullException(); // throws if any argument is null
		return mi.Method.Invoke(mi.Target, mi.Arguments); // executes method on target

How to create a class proxy?

var target = new Goo(); // public class with virtual members
var factory = new ProxyFactory(ProxyBehavior.Spring);
var proxy = factory.Create(target, new NullArgumentInterceptor());
proxy.Go(null); // throws

How to create an interface proxy?

var target = new Foo(); // public class that implements IFoo 
var factory = new ProxyFactory(ProxyBehavior.Spring);
var proxy = factory.Create<IFoo>(target, new NullArgumentInterceptor());
proxy.Go(null); // throws

Last edited Jan 24, 2011 at 2:08 AM by pablomx, version 55