当前位置: 首页>>代码示例>>C#>>正文


C# Registry.RegisterInterceptor方法代码示例

本文整理汇总了C#中Registry.RegisterInterceptor方法的典型用法代码示例。如果您正苦于以下问题:C# Registry.RegisterInterceptor方法的具体用法?C# Registry.RegisterInterceptor怎么用?C# Registry.RegisterInterceptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Registry的用法示例。


在下文中一共展示了Registry.RegisterInterceptor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Process

        /// <summary>
        /// Processes types from an assembly for controllers and implements controller overriding behavior
        /// </summary>
        /// <param name="type">Type to process</param>
        /// <param name="registry">Registry on which to register controllers</param>
        public void Process(Type type, Registry registry)
        {
            // ensure the type is not null, registry isn't null and the type is a valid controller
            if (registry == null || !IsValidController(type))
                return;

            var baseClass = type.BaseType;

            // type must inherit from controller with same type name to be overriden.
            // The type should be added as normal
            // NOTE: this can be extended to be resolved by attribute or something of the sort
            if (!IsValidController(baseClass) || !baseClass.Name.Equals(type.Name))
                registry.AddType(typeof(IController), type);
            else
            {
                registry.AddType(typeof(IController), baseClass);
                registry.RegisterInterceptor(new TypeReplacementInterceptor(baseClass, type));
            }
        }
开发者ID:andycwk-tp,项目名称:Multi-tenancy-Sample,代码行数:24,代码来源:ControllerConvention.cs

示例2: Process

 public void Process(Type type, Registry registry)
 {
     if (type.IsConcreteAndAssignableTo(typeof(TypeInterceptor)))
         registry.RegisterInterceptor((TypeInterceptor)Activator.CreateInstance(type));
 }
开发者ID:caiokf,项目名称:senoc,代码行数:5,代码来源:InterceptorsRegistrationConvention.cs


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