jueves, 14 de octubre de 2010

Fluent NHibernate not autoincrement integer id's

Fluent NHibernate implies from your mapping that every table integer ID is autoincremental. If you have a table with key column INTEGER "not autoincrement" every "insert" clause will fail because the insert's created with NHibernate will not include this column.

To resolve this issue you need to set the GeneratedBy property to "Not" in your map class.

Example:


Id(g => g.property).GeneratedBy.Assigned().Column("IntegerIdColumn");


Fluent NHibernate is an impressive and terrific library, sadly, it is terribly bad documented so easy problems like this become big time consuming issues. :(

No hay comentarios:

Publicar un comentario