We are looking at possibly including NHibernate into a build and a colleague and myself have been trying to get it implemented in a test project.
We have everything set up correctly and it is creating the Configuration, SessionFactory, and actually posting the Schema to the database successfully; however, the line were we initailize the configuration via:
Code:
Configuration configuration = new Configuration();
is taking an extremely long time to run within our project. We have even tried serializing the configuration and loading it after the initial startup and the configuration has been serialized and saved, but it still is taking a really long time.
We are currently using MS SQL Server 2008, we have about 20-30 classes within out namespace, and are only attempting to get it to work with one of these classes at the time being. The initialization time for creating the new Configuration is taking between 1-2 minutes connection to a database server on the local network. We are running this in a thread, but tests with another setup application where it was created in a thread took little to no time at all.
Any insight as to what may be going on here? Application is developed in c# using VS 2010 and .Net Framework 4. Here is our configuration, minus the username and password:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!--
This template was written to work with NHibernate.Test.
Copy the template to your NHibernate.Test project folder and rename it in hibernate.cfg.xml and change it
for your own use before compile tests in VisualStudio.
-->
<!-- This is the System.Data.dll provider for SQL Server -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">
Server=192.168.0.xxx;Initial Catalog=EMTRAC3;User ID=omitted;Password=omitted;
</property>
<property name="adonet.batch_size">10</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
<property name="use_outer_join">true</property>
<property name="command_timeout">60</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
</session-factory>
</hibernate-configuration>
Any help would be greatly appreciated, as we are about to give up on using this if we cannot figure out what is going on. What exactly is the new Configuration doing that would be taking so long?