public static Func <IServiceContext, TPluginType> Build <TPluginType, TPluginTypeProxy>(String instanceName, IEnumerable <IInterceptionBehavior> behaviors)
            where TPluginType : class
            where TPluginTypeProxy : TPluginType
        {
            Func <IServiceContext, TPluginType> proxyFunction = (context) =>
            {
                TPluginType service = context.GetInstance <TPluginTypeProxy>(instanceName);
                return(InterceptorFunctionBuilder.BuildInterceptorsFunction <TPluginType>(behaviors)(service));
            };

            return(proxyFunction);
        }
        public static Func <IServiceContext, TPluginType> Build <TPluginType, TPluginTypeProxy>(IInterceptionBehavior behavior)
            where TPluginType : class
            where TPluginTypeProxy : TPluginType
        {
            Func <IServiceContext, TPluginType> proxyFunction = (context) =>
            {
                TPluginType service = context.GetInstance <TPluginTypeProxy>();
                return(InterceptorFunctionBuilder.BuildInterceptorFunction <TPluginType>(behavior)(service));
            };

            return(proxyFunction);
        }
 public static LambdaInstance <IServiceContext, TPluginType> InterceptWith <TPluginType, TPluginTypeProxy>(this ServiceRegistry.InstanceExpression <TPluginType> instance, String instanceName, IEnumerable <IInterceptionBehavior> behaviors)
     where TPluginType : class
     where TPluginTypeProxy : TPluginType
 {
     return(instance.Use(InterceptorFunctionBuilder.Build <TPluginType, TPluginTypeProxy>(instanceName, behaviors)).Named(instanceName));
 }
 public static LambdaInstance <IServiceContext, TPluginType> InterceptWith <TPluginType, TPluginTypeProxy>(this ServiceRegistry.InstanceExpression <TPluginType> instance, IInterceptionBehavior behavior)
     where TPluginType : class
     where TPluginTypeProxy : TPluginType
 {
     return(instance.Use(InterceptorFunctionBuilder.Build <TPluginType, TPluginTypeProxy>(behavior)));
 }