title: NHibernate 3.3: Setting the type to Ansistring in an Id for Mapping by code
body: <p>I am mapping the following entity as such:</p>
  
  <pre><code>public class PersonEntity
  {
      public virtual string PersonId { get; set; }
  
      public virtual String Salutation { get; set; }
      public virtual String FirstName { get; set; }
      public virtual String LastName { get; set; }
      public virtual DateTime Birthdate { get; set; }
  }
  
  public class PersonMap : ClassMapping&lt;PersonEntity&gt;
  {
      public PersonMap()
      {
          //ComponentAsId(i =&gt; i.Key, map =&gt; map.Property(p =&gt; p.PersonId, m =&gt; m.Type(NHibernateUtil.AnsiString)));
  
          Id(i =&gt; i.PersonId, map =&gt; map.Type(???)));
          Property(i =&gt; i.Salutation);
          Property(i =&gt; i.FirstName);
          Property(i =&gt; i.LastName);
          Property(i =&gt; i.Birthdate);
      }
  }
  </code></pre>
  
  <p>As you can see in the commented out code, I can use the NHibernateUtil to set the type as AnsiString when using components as an Id. However I cannot figure out what to do in plain Id mappings. </p>
  
  <p>I have tried using <code>new NHibernate.Type.AnsiStringType()</code>, but this complains about not having no constructors being defined for it.</p>
  
  <p>Any ideas guys? </p>