/// <summary>
        /// Creates an appropriate type builder. Add a field to hold a reference to the application context.
        /// </summary>
        /// <param name="name">The name to use for the proxy type name.</param>
        /// <param name="baseType">The type to extends if provided.</param>
        /// <returns>The type builder to use.</returns>
        protected override TypeBuilder CreateTypeBuilder(string name, Type baseType)
        {
            TypeBuilder typeBuilder = DynamicProxyManager.CreateTypeBuilder(name, baseType);

            objectFactoryField = typeBuilder.DefineField("__objectFactory", typeof(IObjectFactory),
                                                         FieldAttributes.Private | FieldAttributes.Static | FieldAttributes.InitOnly);

            return(typeBuilder);
        }
Пример #2
0
        static void Main(string[] args)
        {
            var netsisIntegration = DynamicProxyManager <NetsisIntegration> .As <INetsisIntegration>();

            //var y = DynamicProxyManager<NetsisIntegration>.As<INetsisIntegration>();

            netsisIntegration.Method1();
            netsisIntegration.Method2("veri");
            netsisIntegration.Method3(1);
        }
 protected override TypeBuilder CreateTypeBuilder(string name, Type baseType)
 {
     return(DynamicProxyManager.CreateTypeBuilder(name, baseType));
 }