views:

45

answers:

1

Hi,

I think this should be simple, but I can't figure out how to do it. Suppose I have the following maps:

public class AnimalMap : ClassMap<Animal> { Id( x => x.Id); }

public class CatMap: SubclassMap<Cat> {
    Extends<AnimalMap>();
    Map(x => x.IsDomestic);
}

Which creates tables as I expect:

Animal
------
Id

Cat
----
AnimalId : FK to Animal (named FK3500ABA0D)
IsDomestic

As noted, the FK gets generated by the db and ends up as FK3500ABA0D. All I want to do is set the name of that constraint, but I can't find how to do it via Fluent NHibernate (or actually even plain NHibernate, for that matter).

So, what am I missing?

Thanks Andy

A: 

I don't know if FluentNH supports it, but the XML is simple:

<joined-subclass name="Cat">
  <key column="AnimalId" foreign-key="NameOfTheFK"/>
</joined-subclass>
Diego Mijelshon
Excellent, thanks. I may have to add that to Fluent.
Andy
Looks like this wasn't part of the fluent version we are using, so I had to add it manually.
Andy