• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IInterceptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IInterceptor的典型用法代码示例。如果您正苦于以下问题:C# IInterceptor类的具体用法?C# IInterceptor怎么用?C# IInterceptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IInterceptor类属于命名空间,在下文中一共展示了IInterceptor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SelectMethodInterceptors

		private IInterceptor[] SelectMethodInterceptors(IInterceptorSelector selector,
		                                                IInterceptor[] methodInterceptors,
		                                                Type targetType)
		{
			return methodInterceptors ??
			       selector.SelectInterceptors(targetType, Method, interceptors) ??
			       new IInterceptor[0];
		}
开发者ID:alexjamesbrown,项目名称:n2cms,代码行数:8,代码来源:AbstractInvocation.cs


示例2: SelectInterceptors

 public IInterceptor[] SelectInterceptors(Type type, MethodInfo method, IInterceptor[] interceptors)
 {
     if (method.IsAddMethod()) return interceptors.Where(x => x is ListAddInterceptor).ToArray();
     if (method.IsSetMethod()) return interceptors.Where(x => x is ListSetInterceptor).ToArray();
     if (method.IsRemoveMethod()) return interceptors.Where(x => x is ListRemoveInterceptor).ToArray();
     return new IInterceptor[0];
 }
开发者ID:DemgelOpenSource,项目名称:DemgelRedis,代码行数:7,代码来源:ListSelector.cs


示例3: SelectInterceptors

        /// <summary>Select interceptors which must be applied to the method.</summary>
        /// <param name="type">The type.</param>
        /// <param name="method">The method.</param>
        /// <param name="interceptors">The interceptors.</param>
        /// <returns>The interceptors after filtering.</returns>
        public IInterceptor[] SelectInterceptors(Type type, MethodInfo method, IInterceptor[] interceptors)
        {
            if (method.IsGetter())
            {
                var propertyInfo = type.GetProperty(method);
                if (propertyInfo.IsPropertyWithSelectorAttribute())
                {
                    return typeof(BaseHtmlElement).IsAssignableFrom(method.ReturnType) 
                        ? interceptors.Where(x => x is PropertyInterceptor).ToArray() 
                        : interceptors.Where(x => x is CollectionPropertyInterceptor).ToArray();
                }
            }

            if (method.IsSetter())
            {
                var propertyInfo = type.GetProperty(method);
                if (propertyInfo.IsPropertyWithSelectorAttribute())
                {
                    return interceptors.Where(x => x is InvalidWriteOperationInterceptor).ToArray();
                }
            }

            return interceptors.Where(x => !(x is PropertyInterceptor) 
                && !(x is CollectionPropertyInterceptor)
                && !(x is InvalidWriteOperationInterceptor)).ToArray();
        }
开发者ID:pbakshy,项目名称:Selenol,代码行数:31,代码来源:InterceptorSelector.cs


示例4: Invocation

 protected Invocation(object proxy, MethodInfo proxiedMethod, object[] arguments, IInterceptor[] interceptors)
 {
     _proxy = proxy;
     _proxiedMethod = proxiedMethod;
     _arguments = arguments;
     _interceptors = interceptors ?? new IInterceptor[0];
 }
开发者ID:nikodemrafalski,项目名称:nr-cache,代码行数:7,代码来源:Invocation.cs


示例5: InterceptionContext

		public InterceptionContext(IInterceptor[] interceptors)
		{
            //if (interceptors != null)
            {
                _interceptors = new List<IInterceptor>(interceptors);
            }
		}
开发者ID:adwardliu,项目名称:vc-community,代码行数:7,代码来源:InterceptionContext.cs


示例6: SelectInterceptors

        /// <summary>
        ///     The select interceptors.
        /// </summary>
        /// <param name="type">
        ///     The type.
        /// </param>
        /// <param name="method">
        ///     The method.
        /// </param>
        /// <param name="interceptors">
        ///     The interceptors.
        /// </param>
        /// <returns>
        ///     The <see cref="IInterceptor[]" />.
        /// </returns>
        public IInterceptor[] SelectInterceptors(Type type, MethodInfo method, IInterceptor[] interceptors)
        {
            string name = method.Name;
            if (method.IsSpecialName)
            {
                if (name.StartsWith(AopConstants.PropertyGetter, StringComparison.Ordinal)) name = name.Remove(0, AopConstants.PropertyGetter.Length);

                if (name.StartsWith(AopConstants.PropertySetter, StringComparison.Ordinal)) name = name.Remove(0, AopConstants.PropertySetter.Length);

                if (name.StartsWith(AopConstants.EventAdder, StringComparison.Ordinal)) name = name.Remove(0, AopConstants.EventAdder.Length);

                if (name.StartsWith(AopConstants.EventRemover, StringComparison.Ordinal)) name = name.Remove(0, AopConstants.EventRemover.Length);
            }

            return interceptors.Where(
                inter =>
                {
                    var sinter = inter as ISpecificInterceptor;
                    if (sinter != null)
                    {
                        return sinter.Name == name ||
                               sinter.Name == AopConstants.InternalUniversalInterceptorName;
                    }

                    return true;
                }).OrderBy(
                    inter =>
                    {
                        var sinter = inter as ISpecificInterceptor;
                        return sinter == null ? 0 : sinter.Order;
                    }).ToArray();
        }
开发者ID:Tauron1990,项目名称:Tauron-Application-Common,代码行数:47,代码来源:InternalInterceptorSelector.cs


示例7: MockingProxy

		public MockingProxy(MarshalByRefObject wrappedInstance, IInterceptor interceptor, IMockMixin mockMixin)
			: base(wrappedInstance.GetType())
		{
			this.WrappedInstance = wrappedInstance;
			this.interceptor = interceptor;
			this.mockMixin = mockMixin;
		}
开发者ID:somkidodd,项目名称:JustMockLite,代码行数:7,代码来源:MockingProxy.cs


示例8:

        IInterceptor[] IInterceptorSelector.SelectInterceptors(Type type, MethodInfo method, IInterceptor[] interceptors)
        {
            if (interceptors.Length == 0)
                return interceptors;

            var markers = new List<MarkerBaseAttribute>();
            if (type != null)
                markers.AddRange(type.GetCustomAttributes(typeof(MarkerBaseAttribute), true).Cast<MarkerBaseAttribute>());

            if (method != null)
                markers.AddRange(method.GetCustomAttributes(typeof(MarkerBaseAttribute), true).Cast<MarkerBaseAttribute>());

            if (markers.Count == 0) // no marker attributes found, no ordering required
                return interceptors;

            markers.Sort((a, b) => a.Order.CompareTo(b.Order));

            var sorted = new List<IInterceptor>();
            for (int i = 0; i < markers.Count; ++i)
            {
                var providers = interceptors.OfType<IInterceptorMarkerProvider>();
                var markerType = markers[i].GetType();
                var matchingInterceptor = providers.FirstOrDefault(x => x.MarkerType == markerType) as IInterceptor;
                if (matchingInterceptor != null)
                    sorted.Add(matchingInterceptor);
            }
            return sorted.ToArray();
        }
开发者ID:bling,项目名称:AspectCastle,代码行数:28,代码来源:InterceptorSelector.cs


示例9: SessionProvider

 public SessionProvider(IConfigurationBuilder builder, IInterceptor interceptor, IWebContext webContext)
 {
     nhSessionFactory = builder.BuildSessionFactory();
     Debug.WriteLine("Built Session Factory " + DateTime.Now);
     this.webContext = webContext;
     this.interceptor = interceptor;
 }
开发者ID:arp51,项目名称:n2cms,代码行数:7,代码来源:SessionProvider.cs


示例10: RegistrationActivating

        /// <summary>
        /// Registrations the activating.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Autofac.Core.ActivatingEventArgs&lt;System.Object&gt;"/> instance containing the event data.</param>
        private static void RegistrationActivating(object sender, ActivatingEventArgs<object> e)
        {
            // Ignore AspectConfiguration and IInterceptor types since they're being referenced via the Autofac
            // registration context. Otherwise calling e.Context.Resolve<IInterceptor> will fail when
            // the code below executes.
            if (e.Instance.GetType() == typeof (MasterProxy) || e.Instance is IInterceptor)
            {
                return;
            }

            var proxy = (MasterProxy)e.Context.Resolve(typeof(MasterProxy));

            if (!e.Instance.IsDecorated(proxy.Configuration))
            {
                return;
            }

            var pseudoList = new IInterceptor[proxy.Configuration.Interceptors.Count];
            pseudoList[0] = proxy;

            for (var i = 1; i < pseudoList.Length; i++)
            {
                pseudoList[i] = new PseudoInterceptor();
            }

            var interfaceTypes = e.Instance.GetType().GetInterfaces();
            var targetInterface =
                interfaceTypes.FirstMatch(proxy.Configuration.Namespaces);

            e.Instance = new ProxyGenerator().CreateInterfaceProxyWithTargetInterface(targetInterface, e.Instance, pseudoList);
        }
开发者ID:JorgeGamba,项目名称:Snap,代码行数:36,代码来源:AutofacAspectModule.cs


示例11: PostProcess

        public void PostProcess(IServiceRequestResult result)
        {
            var instance = result.ActualResult;
            var instanceTypeName = instance.GetType().FullName;

            // Ignore any LinFu factories or Snap-specific instances.
            if (instanceTypeName.Contains("LinFu.") || instanceTypeName == "Snap.AspectConfiguration"
                || instanceTypeName == "Snap.IMasterProxy" || instanceTypeName == "Snap.MasterProxy")
            {
                return;
            }

            var proxy = result.Container.GetService<IMasterProxy>();

            if (!instance.IsDecorated(proxy.Configuration))
            {
                return;
            }

            var pseudoList = new IInterceptor[proxy.Configuration.Interceptors.Count];
            pseudoList[0] = proxy;

            for (var i = 1; i < pseudoList.Length; i++)
            {
                pseudoList[i] = new PseudoInterceptor();
            }

            var interfaceTypes = instance.GetType().GetInterfaces();
            var targetInterface =
                interfaceTypes.FirstMatch(proxy.Configuration.Namespaces);

            result.ActualResult = new ProxyGenerator().CreateInterfaceProxyWithTargetInterface(targetInterface, instance, pseudoList);
        }
开发者ID:grava,项目名称:Snap,代码行数:33,代码来源:AspectPostProcessor.cs


示例12: Add

        /// <summary>
        /// Add the interceptor in the argument as the first interceptor
        /// and set its next to the interceptor that we have. In the first
        /// execution it will be the TailInterceptor.
        /// </summary>
        /// <param name="interceptor"></param>
        public virtual void Add(IInterceptor interceptor)
        {
            AssertUtil.ArgumentNotNull(interceptor, "interceptor");

            interceptor.Next = m_interceptor;
            m_interceptor = interceptor;
        }
开发者ID:BackupTheBerlios,项目名称:dpml-svn,代码行数:13,代码来源:InterceptedComponent.cs


示例13: SelectInterceptors

 public IInterceptor[] SelectInterceptors(Type type, System.Reflection.MethodInfo method, IInterceptor[] interceptors)
 {
     if (method.Name == "FunA")
         return interceptors;
     return new IInterceptor[0];
     // ...
 }
开发者ID:RandyGong,项目名称:CastleTest,代码行数:7,代码来源:InterceptorSelector.cs


示例14: GetProxy

 public virtual object GetProxy(Type type, IInterceptor interceptor)
 {
     if (cache.ContainsKey(type))
         return cache[type];
     cache[type] = CreateProxy(interceptor, type);
     return cache[type];
 }
开发者ID:domik82,项目名称:bricks-toolkit,代码行数:7,代码来源:CachedDynamicProxyGenerator.cs


示例15: SelectInterceptors

        public IInterceptor[] SelectInterceptors( Type type, MethodInfo method, IInterceptor[] interceptors )
        {
            if( method.Name.StartsWith( "set_" ) )
                return interceptors;

            return null;
        }
开发者ID:RushPm,项目名称:Restful,代码行数:7,代码来源:EntityInterceptorSelector.cs


示例16: RegistrationsFor

        public IEnumerable<IComponentRegistration> RegistrationsFor(Service service, Func<Service, IEnumerable<IComponentRegistration>> registrationAccessor)
        {
            var serviceWithType = service as IServiceWithType;
            if (serviceWithType == null)
                yield break;

            var serviceType = serviceWithType.ServiceType;
            if (!serviceType.IsInterface || !typeof(IEventHandler).IsAssignableFrom(serviceType) || serviceType == typeof(IEventHandler))
                yield break;

            var interfaceProxyType = _proxyBuilder.CreateInterfaceProxyTypeWithoutTarget(
                serviceType,
                new Type[0],
                ProxyGenerationOptions.Default);

            var rb = RegistrationBuilder
                .ForDelegate((ctx, parameters) => {
                    var interceptors = new IInterceptor[] { new EventsInterceptor(ctx.Resolve<IEventBus>()) };
                    var args = new object[] { interceptors, null };
                    return Activator.CreateInstance(interfaceProxyType, args);
                })
                .As(service);

            yield return rb.CreateRegistration();
        }
开发者ID:gokhandisikara,项目名称:Coevery-Framework,代码行数:25,代码来源:EventsRegistrationSource.cs


示例17: SessionFactoryBuilder

 public SessionFactoryBuilder(IDatabaseMappingScheme<MappingConfiguration> mappingScheme,
     IPersistenceConfigurer persistenceConfigurer, IInterceptor interceptor = null)
 {
     _mappingScheme = mappingScheme;
     _persistenceConfigurer = persistenceConfigurer;
     _interceptor = interceptor;
 }
开发者ID:AcklenAvenue,项目名称:AcklenAvenue.Data,代码行数:7,代码来源:SessionFactoryBuilder.cs


示例18: Generate

		public object Generate(IProxyBuilder builder, ProxyGenerationOptions options, IInterceptor[] interceptors)
		{
			var type = GetProxyType(builder);
			var instance = GetProxyInstance(type,interceptors);
			var method = GetInvokeDelegate(instance);
			return method;
		}
开发者ID:gschuager,项目名称:Castle.Windsor,代码行数:7,代码来源:DelegateProxyFactory.cs


示例19: EFCustomerRepository

		public EFCustomerRepository(string connectionStringName, ICustomerEntityFactory entityFactory, IInterceptor[] interceptors = null)
			: base(connectionStringName, factory: entityFactory, interceptors: interceptors)
		{
			this.Configuration.AutoDetectChangesEnabled = true;
			this.Configuration.ProxyCreationEnabled = false;
			Database.SetInitializer(new ValidateDatabaseInitializer<EFCustomerRepository>());
		}
开发者ID:gitter-badger,项目名称:vc-community-1.x,代码行数:7,代码来源:EFCustomerRepository.cs


示例20: StaticInterceptorStub

 private StaticInterceptorStub(MethodInfo method, IInterceptor[] interceptors,
     MethodInfo methodInvocationTarget)
 {
     this.method = method;
     this.interceptors = interceptors;
     this.methodInvocationTarget = methodInvocationTarget;
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:7,代码来源:StaticInterceptorStub.cs



注:本文中的IInterceptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IInternalActorRef类代码示例发布时间:2022-05-24
下一篇:
C# IInterceptedFakeObjectCall类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap