title: NHibernate works when called from one project, but not from the other
body: <p>I'm creating my first application using NHibernate. Unfortunately, I encountered a problem I cannot solve:</p>
  
  <p>I'm accessing the database from "DAL" project that contains CRUD methods and NHibernateHelper class.</p>
  
  <p>I wrote a test project and I tried to add an object to DB - it works perfectly. But when I try to call the same method from my application's ViewModel (it's in the other project as well) it throws an error at <strong>configuration.BuildSessionFactory()</strong> in the code below:</p>
  
  <pre><code>private static ISessionFactory SessionFactory
      {
          get
          {
              if (_sessionFactory == null)
              {
                  var configuration = new Configuration();
                  configuration.Configure();
                  configuration.AddAssembly(typeof(Address).Assembly);
                  _sessionFactory = configuration.BuildSessionFactory();
              }
              return _sessionFactory;
          }
      }
  </code></pre>
  
  <p>The exception:</p>
  
  <pre><code>NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.OracleDataClientDriver.
  System.Reflection.TargetInvocationException: {"Exception has been thrown by the target of an invocation."}
  System.NullReferenceException: {"Object reference not set to an instance of an object."}
  </code></pre>
  
  <p>In my test project I added reference to Oracle.DataAccess.dll and created App.config as it throws the same error without it:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
  &lt;runtime&gt;
  &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
    &lt;qualifyAssembly partialName="Oracle.DataAccess"
           fullName="Oracle.DataAccess,
                          Version=4.112.2.0,
                         Culture=neutral,
                         PublicKeyToken=89b483f429c47342" /&gt;
  &lt;/assemblyBinding&gt;
  &lt;/runtime&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I made the same thing in my project containing ViewModel in which I need to get data from DB, but it didn't help. I also set Copy Local to True for that reference, but to no avail.</p>
  
  <p>It's my App.config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&gt;
    &lt;session-factory&gt;
      &lt;property name="connection.provider"&gt;
        NHibernate.Connection.DriverConnectionProvider
      &lt;/property&gt;
      &lt;property name="dialect"&gt;
        NHibernate.Dialect.Oracle10gDialect
      &lt;/property&gt;
      &lt;property name="connection.driver_class"&gt;
        NHibernate.Driver.OracleDataClientDriver
      &lt;/property&gt;
      &lt;property name="connection.connection_string"&gt;
        User Id=****;
        Password=****;
        Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=
        (PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
        (CONNECT_DATA=(SERVICE_NAME=xe)));
        Pooling=true;
        Enlist=false;
        Statement Cache Size=50;
        Min Pool Size=10;
        Incr Pool Size=5;
        Decr Pool Size=2;
      &lt;/property&gt;
      &lt;property name="show_sql"&gt;
        true
      &lt;/property&gt;
    &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>I'm using NHibernate v 3.3.1.4000, Oracle 11g xe and 64-bit Windows 7 (I cannot choose to debug on 32 or 64-bit, there is only one possibility to select: "Active (Any CPU)" )</p>
  
  <p>What can be the reason that I can use it from test project, but I cannot do it from the other?</p>
  
  <p>Thank you in advance</p>