I define my data model using Fluent nHibernate POCO classes + mappings. I'm also using nHiberate schema to create database schema. All is working fine but there is one unpleasent fact. When I use many-to-one reference referece is named by something similair to GUID ins开发者_运维百科tead of any descriptive name. Here's a piece of SQL:
alter table [Odbiorca]
add constraint FK291D244B5D9E8115
foreign key (Adr_IdKraj)
references [Kraj]
I want nHiberate to generate something like Sql Studio does like [FK_Odbiorca_Kraj]
.
Is it doable by overridding mappings or by creating any convention?
I don't know Fluent, but with regular XML mapping you just can use the foreign-key
attribute:
<many-to-one
name="Kraj"
class="Kraj"
column="Adr_IdKraj"
foreign-key="FK_Odbiorca_Kraj"/>
精彩评论