title: FluentNHibernate table column order
body: <p>I can't seem to make my table's column order right with Fluent NHibernate.</p>
  
  <p>Employee.cs</p>
  
  <pre><code>public class Employee : Entity
  {
      #region Fields
  
      private EmployeeStatus _status;
      private DateTime _created;
      private DateTime? _updated;
  
      #endregion
  
      #region Constructor
  
      public Employee()
      {
          _status = EmployeeStatus.Active;
          _created = DateTime.Now;
      }
  
      #endregion
  
      #region Properties
  
      public virtual string FirstName { get; set; }
      public virtual string MiddleName { get; set; }
      public virtual string LastName { get; set; }
  
      public virtual string FullName
      {
          get
          {
              return string.Format("{0} {1} {2}", FirstName, MiddleName, LastName);
          }
      }
  
      public virtual Gender Gender { get; set; }
      public virtual DateTime BirthDate { get; set; }
      public virtual Address HomeAddress { get; set; }
  
      public virtual EmployeeStatus IsActive
      {
          protected set { _status = value; }
          get { return _status; }
      }
  
      public virtual DateTime Created
      {
          protected set { _created = value; }
          get { return _created; }
      }
  
      public virtual DateTime? Updated
      {
          protected set { _updated = value; }
          get { return _updated; }
      }
  
      #endregion
  
      #region Overrides
  
      public override string ToString()
      {
          return FullName;
      }
  
      #endregion
  }
  </code></pre>
  
  <p>HomeAddress.cs</p>
  
  <pre><code>public class Address : ValueObject&lt;Address&gt;
  {
      #region Properties
  
      public virtual string City { get; private set; }
      public virtual string Zipcode { get; private set; }
      public virtual string AddressLine { get; private set; }
  
      #endregion
  
      #region Constructor
  
      public Address(string city, string zipcode, string addressLine)
      {
          City = city;
          Zipcode = zipcode;
          AddressLine = addressLine;
      }
  
      /// &lt;summary&gt;
      /// Required by NHibernate
      /// &lt;/summary&gt;
      protected Address() { }
  
      #endregion
  
  }
  </code></pre>
  
  <p>EmployeeMap.cs</p>
  
  <pre><code>public class EmployeeMap : ClassMap&lt;Employee&gt;
  {
      public EmployeeMap()
      {
          Id(x =&gt; x.Id)
              .GeneratedBy.Guid();
          Map(x =&gt; x.FirstName);
          Map(x =&gt; x.MiddleName);
          Map(x =&gt; x.LastName);
          Map(x =&gt; x.BirthDate);
          Component(x =&gt; x.HomeAddress, m =&gt;
          {
              m.Map(x =&gt; x.City);
              m.Map(x =&gt; x.Zipcode);
              m.Map(x =&gt; x.AddressLine);
          });
          Map(x =&gt; x.IsActive);
          Map(x =&gt; x.Created);
          Map(x =&gt; x.Updated);
      }
  }
  </code></pre>
  
  <p>Based on above, I expected </p>
  
  <pre><code>Id 
  FirstName
  MiddleName
  LastName
  BirthDate
  City
  Zipcode
  AddressLine
  IsActive
  Created
  Updated
  </code></pre>
  
  <p>but instead NHibernate outputing this : </p>
  
  <pre><code>create table `Employee` (
          Id VARCHAR(40) not null,
         FirstName VARCHAR(255),
         MiddleName VARCHAR(255),
         LastName VARCHAR(255),
         BirthDate DATETIME,
         IsActive INTEGER,
         Created DATETIME,
         Updated DATETIME,
         City VARCHAR(255),
         Zipcode VARCHAR(255),
         AddressLine VARCHAR(255),
         primary key (Id)
      )
  </code></pre>
  
  <p>Is it possible to order table's column just from NHibernate / FluentNHibernate? Or should I create those columns structure manually in database first?</p>
  
  <p>Thanks!</p>