protected virtual GenerateProxiesResult GenerateProxies(Configuration nhibernateConfiguration, string modulePath) { const string assemblyName = "GeneratedAssembly"; var proxies = new Dictionary <string, System.Type>(); var assemblyBuilder = new SavingProxyAssemblyBuilder(assemblyName, modulePath); try { GeneratorProxyFactoryFactory.ProxyFactory = new GeneratorProxyFactory(new ProxyFactory(assemblyBuilder), proxies); using (nhibernateConfiguration.BuildSessionFactory()) { } } finally { GeneratorProxyFactoryFactory.ProxyFactory = null; } assemblyBuilder.Save(); var proxyAssemblyName = new AssemblyName(assemblyName) { CodeBase = modulePath }; var proxyAssembly = Assembly.Load(proxyAssemblyName); return(new GenerateProxiesResult(proxies, proxyAssembly)); }
protected virtual GenerateProxiesResult GenerateProxies(Configuration nhibernateConfiguration, string modulePath) { const string assemblyName = "GeneratedAssembly"; var proxies = new Dictionary<string, System.Type>(); var assemblyBuilder = new SavingProxyAssemblyBuilder(assemblyName, modulePath); try { GeneratorProxyFactoryFactory.ProxyFactory = new GeneratorProxyFactory(new ProxyFactory(assemblyBuilder), proxies); using (nhibernateConfiguration.BuildSessionFactory()) { } } finally { GeneratorProxyFactoryFactory.ProxyFactory = null; } assemblyBuilder.Save(); var proxyAssemblyName = new AssemblyName(assemblyName) { CodeBase = modulePath }; var proxyAssembly = Assembly.Load(proxyAssemblyName); return new GenerateProxiesResult(proxies, proxyAssembly); }