title: FluentNhibernate not creating an Id column as an identity with SQL CE 4.0
body: <p>I have am trying to create some integration tests with no external database dependencies so am using SQL CE 4.0 and trying to configure it with FluentNhibernate. </p>
  
  <p>I have gotten so far as having the tests create the database file each time it runs, then create the table that i want to use but it never sets the Id column to and identity specification. When i then try and insert into the table with Nhibernate it complains about a null identity column. </p>
  
  <p>This is my mapping defenition and data class:</p>
  
  <pre><code>public class AffiliateApplicationRecord
  {
      public virtual int Id { get; private set; }
      public virtual string CompanyName { get; set; }
      public virtual string Email { get; set; }
      public virtual string DomainName { get; set; }
      public virtual DateTime DateReceived { get; set; }
  
      public AffiliateApplicationRecord()
      {
          DateReceived = DateTime.Now;
      }
  }
  
  public class AffiliateApplicationRecordMap : ClassMap&lt;AffiliateApplicationRecord&gt;
  {
      public AffiliateApplicationRecordMap()
      {
          Table("Partner");
          Id(x =&gt; x.Id).GeneratedBy.Identity();
          Map(x =&gt; x.CompanyName, "Name");
          Map(x =&gt; x.DomainName, "Domain");
          Map(x =&gt; x.Email);
          Map(x =&gt; x.DateReceived, "TimeStampCreated");
      }
  }
  </code></pre>
  
  <p>And these are the methods that configure the Session Factory which i call in my repositories to get a session factory to run queries/insert data.</p>
  
  <p><strong>EDIT: Added Dialect configuration...</strong></p>
  
  <pre><code>private ISessionFactory CreateSessionFactory()
      {
  
          var config = Fluently.Configure()
              .Database(
                  MsSqlCeConfiguration.Standard
                      .Dialect&lt;MsSqlCe40Dialect&gt;()
                      .ConnectionString("Data Source=DatabaseFileName.sdf"))
              .Mappings(m =&gt; m.FluentMappings.AddFromAssembly(typeof(AffiliateApplicationRecord).Assembly))
              .ExposeConfiguration(BuildSchema)
              .BuildConfiguration()
  
          return config.BuildSessionFactory();
      }
  
      private static void BuildSchema(Configuration config)
      {
          new SchemaExport(config).Create(false, true);
      }
  </code></pre>
  
  <p>I'd really appreciate help with this. I am worried that either Fluent won't do this for me or that SQL CE won't work.</p>
  
  <p>Thanks in advance for the help.</p>