Fluent nHibernate no identity column in table

fluent-nhibernateidentity

How do I specify with fluent NHibernate mapping for a table that doesn't have an identity column?

I want something like this:

public sealed class CustomerNewMap : ClassMap<CustomerNew>, IMap
{
    public CustomerNewMap()
    {
        WithTable("customers_NEW");
        Not.LazyLoad();
        Not.Id(); // this is invalid...
        Map(x => x.Username);
        Map(x => x.Company);
    }
}

I mean no primary key defined in the database (not much defined in the database).

Best Answer

I found the answer to be:

  public CustomerNewMap()
  {
        WithTable("customers_NEW");
        Not.LazyLoad();
        Id(x => x.Username).GeneratedBy.Assigned();
        Map(x => x.Company);
  }