public static IInterceptionConfiguration With(this IInterceptionConfiguration interceptionConfiguration, Func <IInvocation, Func <Task>, Task> interceptFunc) { Guard.NotNull(interceptionConfiguration, nameof(interceptionConfiguration)) .Interceptors.Add(new DelegateInterceptor(interceptFunc)); return(interceptionConfiguration); }
public static IInterceptionConfiguration With(this IInterceptionConfiguration interceptionConfiguration, Func <IInvocation, Func <Task>, Task> interceptFunc) { if (null != interceptFunc) { interceptionConfiguration.Interceptors.Add(new DelegateInterceptor(interceptFunc)); } return(interceptionConfiguration); }
public InterceptedObjectService(IObjectService real, IInterceptionConfiguration configuration) { this.real = real; this.configuration = configuration; applicationModel = configuration.GetInterceptor(InterceptionTarget.ApplicationModel); get = configuration.GetInterceptor(InterceptionTarget.Get); @do = configuration.GetInterceptor(InterceptionTarget.Do); }
/// <summary> /// Initializes a new instance of the <see cref="InterceptingCatalog"/> class. /// </summary> /// <param name="interceptedCatalog">Catalog to be intercepted.</param> /// <param name="configuration">Interception configuration.</param> public InterceptingCatalog(ComposablePartCatalog interceptedCatalog, IInterceptionConfiguration configuration) { if (interceptedCatalog == null) throw new ArgumentNullException("interceptedCatalog"); if (configuration == null) throw new ArgumentNullException("configuration"); this.interceptedCatalog = interceptedCatalog; this.interceptedCatalogNotifyChange = interceptedCatalog as INotifyComposablePartCatalogChanged; this.configuration = configuration; InitializeHandlers(); }
public static IInterceptionConfiguration With <TInterceptor>(this IInterceptionConfiguration interceptionConfiguration, params object?[] parameters) where TInterceptor : IInterceptor { if (Guard.NotNull(parameters, nameof(parameters)).Length == 0) { interceptionConfiguration.With(NewFuncHelper <TInterceptor> .Instance()); } else { interceptionConfiguration.With(ActivatorHelper.CreateInstance <TInterceptor>(parameters)); } return(interceptionConfiguration); }
/// <summary> /// Initializes a new instance of the <see cref="InterceptingCatalog"/> class. /// </summary> /// <param name="interceptedCatalog">Catalog to be intercepted.</param> /// <param name="configuration">Interception configuration.</param> public InterceptingCatalog(ComposablePartCatalog interceptedCatalog, IInterceptionConfiguration configuration) { if (interceptedCatalog == null) throw new ArgumentNullException("interceptedCatalog"); if (configuration == null) throw new ArgumentNullException("configuration"); this.interceptedCatalog = interceptedCatalog; this.configuration = configuration; this.innerParts = new Dictionary<ComposablePartDefinition, InnerPartDefinition>(); InitializeRecomposition(); InitializeHandlers(); }
public ContextBuilder Using( IRestClient restClient = null, IJsonSerializer serializer = null, ICache cache = null, IInterceptionConfiguration interceptionConfiguration = null ) { this.restClient = restClient ?? new WebRequestRestClient(); this.serializer = serializer ?? new JsonSerializerAdapter(); this.cache = cache ?? new DictionaryCache(); this.interceptionConfiguration = interceptionConfiguration; return(this); }
/// <summary> /// Initializes a new instance of the <see cref="InterceptingCatalog"/> class. /// </summary> /// <param name="interceptedCatalog">Catalog to be intercepted.</param> /// <param name="configuration">Interception configuration.</param> public InterceptingCatalog(ComposablePartCatalog interceptedCatalog, IInterceptionConfiguration configuration) { if (interceptedCatalog == null) { throw new ArgumentNullException("interceptedCatalog"); } if (configuration == null) { throw new ArgumentNullException("configuration"); } this.interceptedCatalog = interceptedCatalog; this.configuration = configuration; this.innerParts = new Dictionary <ComposablePartDefinition, InnerPartDefinition>(); InitializeRecomposition(); InitializeHandlers(); }
public static IInterceptionConfiguration With <TInterceptor>(this IInterceptionConfiguration interceptionConfiguration) where TInterceptor : IInterceptor, new() { interceptionConfiguration.With(new TInterceptor()); return(interceptionConfiguration); }
public static IInterceptionConfiguration With(this IInterceptionConfiguration interceptionConfiguration, IInterceptor interceptor) { interceptionConfiguration.Interceptors.Add(interceptor); return(interceptionConfiguration); }