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


C# ProxyGenerator.CreateInterfaceProxyWithTargetInterface方法代码示例

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


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

示例1: CreateInterfaceProxyWithTargetInterface

        public static object CreateInterfaceProxyWithTargetInterface(Type interfaceType, object concreteObject)
        {
            var proxyGenerator = new ProxyGenerator();
            var result = proxyGenerator.CreateInterfaceProxyWithTargetInterface(interfaceType,
                concreteObject,
                new IInterceptor[] { new LogInterceptor(LogManager.GetLogger(concreteObject.GetType())) });

            return result;
        }
开发者ID:stantoxt,项目名称:LoggerPoc,代码行数:9,代码来源:DynamicProxyHelper.cs

示例2: Main

        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            
            // TODO: Implement Functionality Here
            
            IUiElement rootElement =
                UIAutomation.UiElement.RootElement;
            
            DateTime startDate = System.DateTime.Now;
            
            var proxyGenerator =
                new ProxyGenerator();
            
            var proxiedRootElement =
                proxyGenerator.CreateInterfaceProxyWithTargetInterface(
                    typeof(IUiElement),
                    rootElement,
                    new StandardInterceptor[]{});
            
            Console.WriteLine((System.DateTime.Now - startDate).Seconds.ToString() + "; " + (System.DateTime.Now - startDate).Ticks.ToString());
            
            Console.WriteLine(proxiedRootElement.GetType().Name);
            
            IUiElement proxiedtypedRootElement =
                proxiedRootElement as IUiElement;
            
            // 20140312
//            Console.WriteLine(proxiedtypedRootElement.Current.Name);
//            Console.WriteLine(proxiedtypedRootElement.Current.AutomationId);
//            Console.WriteLine(proxiedtypedRootElement.Current.ClassName);
            Console.WriteLine(proxiedtypedRootElement.GetCurrent().Name);
            Console.WriteLine(proxiedtypedRootElement.GetCurrent().AutomationId);
            Console.WriteLine(proxiedtypedRootElement.GetCurrent().ClassName);
            
            var originalElement =
                proxiedtypedRootElement.GetSourceElement();
//            Console.WriteLine(originalElement.Current.Name);
//            Console.WriteLine(originalElement.Current.AutomationId);
//            Console.WriteLine(originalElement.Current.ClassName);
            var arr = proxiedtypedRootElement.GetSupportedPatterns();
            foreach (var ptrn in arr) {
                Console.WriteLine(ptrn.ToString());
                // Console.WriteLine(ptrn.SourcePattern as automationpa
            }
            
            
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:50,代码来源:Program.cs

示例3: defaultContainer

        private static Container defaultContainer()
        {
            return new Container(ioc =>
            {
                ioc.Scan(scan =>
                {
                    scan.TheCallingAssembly();
                    scan.WithDefaultConventions();
                });

                // It's a manual wiring up method.
                var proxyGenerator = new ProxyGenerator();
                ioc.For<IMyMath>().DecorateAllWith(myMath =>
                    proxyGenerator.CreateInterfaceProxyWithTargetInterface(myMath, new ExceptionAspect()));
            });
        }
开发者ID:VahidN,项目名称:AOP-Sample,代码行数:16,代码来源:SmObjectFactory.cs

示例4: GetMyClass

        public IMyClass GetMyClass()
        {
            var proxyGenerator = new ProxyGenerator();

            var myClass = proxyGenerator.CreateInterfaceProxyWithTargetInterface<IMyClass>(
                new MyClass { Name = "ChavP" },
                new MyInterceptorErrorAspect(),
                new MyInterceptorAspect());

            return myClass;
        }
开发者ID:chavp,项目名称:Patterns,代码行数:11,代码来源:UnitTest1.cs


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