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


C# ProxyGenerator.CreateProxy方法代码示例

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


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

示例1: CreateProxy

 private Object CreateProxy(Type[] interfaces, IPicoContainer container)
 {
     try
     {
         ProxyGenerator proxyGenerator = new ProxyGenerator();
         object componentInstance = Delegate.GetComponentInstance(container);
         return proxyGenerator.CreateProxy(interfaces, new PicoInterceptor(), componentInstance);
     }
     catch (ArgumentException e)
     {
         throw new PicoIntrospectionException("Error creating a dynamic proxy for implementation hiding", e);
     }
 }
开发者ID:smmckay,项目名称:picocontainer,代码行数:13,代码来源:ImplementationHidingComponentAdapter.cs

示例2: NewInstance

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dao"></param>
        /// <returns></returns>
        public static IDao NewInstance(Dao dao)
        {
            ProxyGenerator proxyGenerator = new ProxyGenerator();
            IInterceptor handler = new DaoProxy(dao);
            Type[] interfaces = {dao.DaoInterface, typeof(IDao)};

            return (proxyGenerator.CreateProxy(interfaces, handler, dao.DaoInstance) as IDao);
        }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:13,代码来源:DaoProxy.cs

示例3: CreateScript

		protected IScript CreateScript(IList assemblies)
		{
			try
			{
				Assembly dynamicAssembly = GetCompiledAssembly(StreamReader, assemblies);
				Type compiledType = getCompiledType(dynamicAssembly);
				object instance = dynamicAssembly.CreateInstance(compiledType.FullName);

				ProxyGenerator proxyGenerator = new ProxyGenerator();
				return (IScript) proxyGenerator.CreateProxy(typeof (IScript), new ScriptInterceptor(), instance);
			}
			catch (ArgumentException e)
			{
				throw new PicoCompositionException("The script is not usable. Please specify a correct script.", e);
			}
		}
开发者ID:smmckay,项目名称:picocontainer,代码行数:16,代码来源:ScriptedContainerBuilder.cs

示例4: NameBugReportedTest

		public void NameBugReportedTest()
		{
			ProxyGenerator proxyGenerator = new ProxyGenerator();
			Castle.DynamicProxy.Test.ClassInterfaces.C.IBubu bubuC = (Castle.DynamicProxy.Test.ClassInterfaces.C.IBubu)
				proxyGenerator.CreateProxy(typeof(Castle.DynamicProxy.Test.ClassInterfaces.C.IBubu), new SimpleInterceptor(), new object());
			bubuC.OperationA();
			
			Castle.DynamicProxy.Test.ClassInterfaces.D.IBubu bubuD = (Castle.DynamicProxy.Test.ClassInterfaces.D.IBubu)
				proxyGenerator.CreateProxy(typeof(Castle.DynamicProxy.Test.ClassInterfaces.D.IBubu), new SimpleInterceptor(), new object());
			bubuD.OperationB();
		}
开发者ID:atczyc,项目名称:castle,代码行数:11,代码来源:ProxyGeneratorTestCase.cs

示例5: NewInstance

        /// <summary>
        /// Static constructor
        /// </summary>
        /// <param name="connection">The connection which been proxified.</param>
        /// <param name="provider">The provider used</param>
        /// <returns>A proxy</returns>
        internal static IDbConnection NewInstance(IDbConnection connection, Provider provider)
        {
            object proxyConnection = null;
            IInterceptor handler = new IDbConnectionProxy(connection, provider);

            ProxyGenerator proxyGenerator = new ProxyGenerator();

            proxyConnection = proxyGenerator.CreateProxy(typeof(IDbConnection), handler, connection);

            return (IDbConnection) proxyConnection;
        }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:17,代码来源:IDbConnectionProxy.cs


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