i’m using oracle with FluentNHibernate automapping with alterations & NHibernate
the problem is how to specify the constraint name by overriding the mapping model??
the generated sql like this:
alter table FirstTable
add constraint FK_VerLongIdentifierLongerThan30Characther
foreign key (FirstTableID)
references SecondTable;
i need to change the “FK_VerLongIdentifierLongerThan30Characther” to smaller identifier by overriding the mapping model like this:
model.Override<SomeClass>(m =>
{
m.HasOne<SomeOtherClass>(c => c.SomeProperty).?????????;
//or
m.????????
}
)
Instead of doing an override for each class with this problem, what I have done is create a mapping convention which would truncate objects with surpass a 30-character naming scheme on foreign keys, has many and many to many relations:
Then I would call these conventions like this:
Here’s the
Truncateextension:I hope this is useful in any way. 🙂