private static ProxyInstantiator BuildInstantiator(Type type) { var proxyGenerator = new ProxyGenerator(); var generatedClassResult = proxyGenerator.Generate(type); var hostingContainer = new HostingContainer(); var scriptEngine = new ScriptEngine(GetRequiredAssemblies(type)); var scriptSession = Session.Create(hostingContainer); scriptEngine.Execute(generatedClassResult.Code, scriptSession); scriptEngine.Execute(@"ProxyInstantiator = new ProxyInstantiator((innerTarget,configuration) => new " + generatedClassResult.GeneratedClassName + "((" + type.GetFullName() + ")innerTarget, configuration));", scriptSession); return(hostingContainer.ProxyInstantiator); }
protected void Application_Start(object sender, EventArgs e) { var catalog = new AssemblyCatalog(typeof(Global).Assembly); _hosting = new HostingContainer("bundles", catalog); }
protected void Application_Start(object sender, EventArgs e) { var catalog = new AssemblyCatalog(typeof(Global).Assembly); _hosting = new HostingContainer("bundles", catalog); }