/// <summary> /// Initializes a new instance of the <see cref="MessageInterceptors" /> class. /// </summary> /// <param name="interceptors">The interceptors.</param> /// <param name="interceptorFactory">The interceptor factory.</param> public MessageInterceptors(IEnumerable <IMessageInterceptor> interceptors, IInterceptorFactory interceptorFactory) { _interceptorFactory = interceptorFactory; _createdInterceptors = new ConcurrentDictionary <Type, IMessageInterceptor>(); _interceptors = interceptors; }
public bool RemoveFactory(IInterceptorFactory factory) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } return(_childFactories.Remove(factory)); }
/// <summary> /// Initialize new instance of <see cref="PipelineManager"/> with the specified interceptor factory. /// </summary> /// <param name="interceptorFactory"></param> public PipelineManager(IInterceptorFactory interceptorFactory) { if (interceptorFactory == null) { throw new ArgumentNullException(nameof(interceptorFactory)); } _interceptorFactory = interceptorFactory; }
public void TryAddFactory(IInterceptorFactory factory) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } if (!_childFactories.Contains(factory)) { _childFactories.Add(factory); } }
/// <summary> /// Creates a new instance of the <see cref="MockedDependencyFactory"/> type. /// </summary> /// <param name="dynamicProxyFactory"> A factory that can create a dynamic proxy for a given dependency. </param> /// <param name="interceptorFactory"> A factory that can create an interceptor for a given dependency. </param> public MockedDependencyFactory(IDynamicProxyFactory dynamicProxyFactory, IInterceptorFactory interceptorFactory) { DynamicProxyFactory = dynamicProxyFactory ?? throw new ArgumentNullException(nameof(dynamicProxyFactory)); InterceptorFactory = interceptorFactory ?? throw new ArgumentNullException(nameof(interceptorFactory)); }
/// <summary> /// Specify the interceptor factory to be used by the <paramref name="container"/>. /// </summary> /// <param name="container">The container to add interceptor factory.</param> /// <param name="factory">The requested interceptor factory.</param> /// <returns>The <see cref="IServiceContainer"/> object that this method was called on.</returns> public static IServiceContainer UseInterceptorFactory(this IServiceContainer container, IInterceptorFactory factory) { if (container == null) { throw new ArgumentNullException(nameof(container)); } if (factory == null) { throw new ArgumentNullException(nameof(factory)); } EnsureInterceptorFactory(container).TryAddFactory(factory); return(container); }
public InterfaceProxyWithoutTargetProvider(IProxyGenerator proxyGenerator, IInterceptorFactory interceptorFactory) { this.proxyGenerator = proxyGenerator; this.interceptorFactory = interceptorFactory; }
private static object CreateInstance(IServiceProvider provider, Type serviceType, object implementationInstance) { IInterceptorFactory builder = provider.GetRequiredService <IInterceptorFactory>(); return(builder.CreateProxy(serviceType, implementationInstance)); }
/// <summary> /// Initializes a new instance of the <see cref="RepositoryExtensionsProvider"/> class. /// </summary> /// <param name="interceptorFactory"> /// The interceptor factory. /// </param> /// <param name="scope"> /// The object scope. /// </param> public RepositoryExtensionsProvider(IInterceptorFactory interceptorFactory, IScope scope) { this.InterceptorFactory = interceptorFactory; this.Scope = scope; }