public static LambdaInstance <IServiceContext, TPluginType> InterceptWith <TPluginType, TPluginTypeProxy>(this ServiceRegistry.InstanceExpression <TPluginType> instance, String instanceName, Type behaviorType) where TPluginType : class where TPluginTypeProxy : TPluginType { IInterceptionBehavior behavior = (IInterceptionBehavior)Activator.CreateInstance(behaviorType); return(instance.InterceptWith <TPluginType, TPluginTypeProxy>(instanceName, behavior)); }
public static LambdaInstance <IServiceContext, TPluginType> InterceptWith <TPluginType, TPluginTypeProxy>(this ServiceRegistry.InstanceExpression <TPluginType> instance, String instanceName, IEnumerable <Type> behaviorTypes) where TPluginType : class where TPluginTypeProxy : TPluginType { ICollection <IInterceptionBehavior> behaviors = new List <IInterceptionBehavior>(); foreach (Type behavior in behaviorTypes) { behaviors.Add((IInterceptionBehavior)Activator.CreateInstance(behavior)); } return(instance.InterceptWith <TPluginType, TPluginTypeProxy>(instanceName, behaviors)); }