Free nHibernate no column in table

How can I specify with a smooth NHibernate display for a table that does not have an identity column?

I need 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, the primary key defined in the database (not very defined in the database) is not defined.

+4
source share
3 answers

I found the answer:

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

This does not directly answer the question .. but it answers the question in the comment on the accepted answer here.

SQL View . , NHibernate , Id . .. Ledger, CustomerAccountId Id.., . , CompositeId, , , . CustomerAccountId WeekEnding:

CompositeId()
    .KeyProperty(x => x.CustomerAccountId)
    .KeyProperty(x => x.WeekEnding);

, NHibernate .

+2

, . -

  Id(x => x.Username).Column("Username").GeneratedBy.Assigned();
0

All Articles