title: NHibernate 3.2: SchemaExport not working with SQLite
body: <p>I'm using an in-memory db for some quick unit tests, using the following code:</p>
  
  <pre><code>public class MemoryDb
  {
      private static Configuration configuration;
      private static ISessionFactory sessionFactory;
  
      static MemoryDb()
      {
          configuration = new NHibernate.Cfg.Configuration();
  
          configuration.DataBaseIntegration(x =&gt;
          {
              x.Driver&lt;SQLite20Driver&gt;();
              x.Dialect&lt;SQLiteDialect&gt;();
              x.ConnectionProvider&lt;DriverConnectionProvider&gt;();
              x.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;
              x.IsolationLevel = IsolationLevel.ReadCommitted;
              x.ConnectionString = "Data Source=:memory:;";
              x.Timeout = 255;
              x.BatchSize = 100;
              x.LogFormattedSql = true;
              x.LogSqlInConsole = true;
              x.AutoCommentSql = false;
          });
  
          configuration.AddMapping(DbHelper.GetAutoMappings());
          sessionFactory = configuration.BuildSessionFactory();
      }
  
      public static ISession GetSession()
      {
          var session = sessionFactory.OpenSession();
          new SchemaExport(configuration).Execute(true, true, false, session.Connection, null);
          return session;
      }
  }
  </code></pre>
  
  <p>The problem is that the schema export doesn't seem to be working. On of my tests looks like this:</p>
  
  <pre><code>[Fact]
  public void ShouldFindDuplicateByEmail()
  {
      using (var session = MemoryDb.GetSession())
      {
          var repo = new NHibernateCustomerRepository(session);
          var customer = new Customer();
          customer.EmailAddress = "test@test.com";
          repo.Save(customer);
  
          var duplicates = repo.FindDuplicates(customer);
          Assert.Equal(1, duplicates.Length);
      }
  }
  </code></pre>
  
  <p>The test fails with the error <code>no such table: Customers</code>. This all worked with Fluent NHibernate and NHibernate 3.1. I know it's not an issue with the mappings themselves, because the actual application works when I run it against an existing SQL Server db. It only fails when running the tests. Any thoughts?</p>
  
  <p>Edit: If I change only the connection string such that it writes to a file (i.e. <code>x.ConnectionString = "data source=" + Path.GetTempFileName();</code>, the whole thing works. I'm guessing either the schema isn't run correctly against the in-memory db, or it's getting a new in-memory db each time I execute a session command, but have no clue how to figure this out.</p>