views:

893

answers:

1

I am trying to create a mapping to a database table that has no primary keys/references.

public class TestMap : ClassMap<Test> {

public TestMap() {

    WithTable("TestTable");

    Map(x => x.TestColumn);

}

}

This fails and expects id or composite-id. Is this possible in fluent nhibernate?

+1  A: 

No. You'll have to add a surrogate primary key, such as an identity column in SQL Server, to map this table. As far as I know, this isn't supported by NHibernate itself.

Why don't you have a primary key on this table?

Jamie Ide

related questions