更改 FluentNhibernate 自动映射更改中的约束名称
我正在使用 Oracle 和 FluentNHibernate 自动映射,并进行更改和修改。 NHibernate 问题是如何通过覆盖映射模型来指定约束名称?
生成的sql如下:
alter table FirstTable
add constraint FK_VerLongIdentifierLongerThan30Characther
foreign key (FirstTableID)
references SecondTable;
我需要通过覆盖映射模型将“FK_VerLongIdentifierLongerThan30Characther”更改为更小的标识符,如下所示:
model.Override<SomeClass>(m =>
{
m.HasOne<SomeOtherClass>(c => c.SomeProperty).?????????;
//or
m.????????
}
)
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.????????
}
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我所做的不是对每个存在此问题的类进行覆盖,而是创建一个 映射约定 会截断外键上超过 30 个字符的命名方案的对象,具有许多多对多的关系:
然后我会这样调用这些约定:
Here's the
Truncate
extension:我希望这在任何方面都有用。 :)
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
Truncate
extension:I hope this is useful in any way. :)