main
 1using Autofac;
 2using Autofac.Builder;
 3using Castle.DynamicProxy;
 4using solidware.financials.infrastructure;
 5
 6namespace solidware.financials.windows.ui.bootstrappers
 7{
 8    static public class AutofacExtensions
 9    {
10        static readonly IProxyFactory factory = new CastleProxyFactory();
11
12        static public IRegistrationBuilder<Interface, SimpleActivatorData, SingleRegistrationStyle> RegisterProxy
13            <Interface, Implementation>(
14            this ContainerBuilder builder, params IInterceptor[] interceptors) where Implementation : Interface where Interface : class
15        {
16            builder.RegisterType<Implementation>();
17            return builder.Register(x => factory.CreateProxyFor<Interface>(x.Resolve<Implementation>(), interceptors)).As<Interface>();
18        }
19    }
20}