コード例 #1
0
        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);
        }
コード例 #2
0
 public static IInterceptionConfiguration With(this IInterceptionConfiguration interceptionConfiguration, Func <IInvocation, Func <Task>, Task> interceptFunc)
 {
     if (null != interceptFunc)
     {
         interceptionConfiguration.Interceptors.Add(new DelegateInterceptor(interceptFunc));
     }
     return(interceptionConfiguration);
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        /// <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();
        }
コード例 #5
0
 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);
 }
コード例 #6
0
        /// <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();
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        /// <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();
        }
コード例 #9
0
 public static IInterceptionConfiguration With <TInterceptor>(this IInterceptionConfiguration interceptionConfiguration) where TInterceptor : IInterceptor, new()
 {
     interceptionConfiguration.With(new TInterceptor());
     return(interceptionConfiguration);
 }
コード例 #10
0
 public static IInterceptionConfiguration With(this IInterceptionConfiguration interceptionConfiguration, IInterceptor interceptor)
 {
     interceptionConfiguration.Interceptors.Add(interceptor);
     return(interceptionConfiguration);
 }