3

Is there a way in Fluent NHibernate (or possibly NHibernate in general) to tell it to generate the primary keys differently? It creates the column name for the key fine, but the index/constraint gets weird generated names like:

PK__Address__3214EC2725332734

PK__CreditCa__3214EC2756CA82C8

etc.

I can use straight SQL to rename them but I'd rather not.

Marijn
  • 10,367
  • 5
  • 59
  • 80
fregas
  • 3,192
  • 3
  • 25
  • 41

2 Answers2

9

This is a similar question to this:

Fluent NHibernate primary key constraint naming conventions

It doesn't seem possible to do it because NHibernate itself doesn't support it.

(I was irked to find out).

Community
  • 1
  • 1
Reiste
  • 316
  • 5
  • 13
-1

You should be able to name all constraints thus:

http://marcinobel.com/index.php/fluent-nhibernate-conventions-examples/

Hope this helps, I checked with some colleagues...

gbn
  • 422,506
  • 82
  • 585
  • 676