开发者

Prevent Nhibernate schemaexport from generating foreign key constraints on has many relationship

I have a mapping like this:

HasMany(x => x.Orders).KeyColumn("CustomerID");

Which is causing a constraint like this to be generated by schemaexport:

alter table [CustomerOrder] 
    add constraint FK45B3FB85AF01218D 
    foreign key (CustomerID) 
    references [Customer]

I have tried adding .NotFound.Ignore() like on a Referen开发者_如何转开发ces() mapping to disable the constraint from being generated but this does not work.

Can a mapping be defined that will force SchemaExport to not generate the constraint?


Figured it out:

HasMany(x => x.Orders).KeyColumn("CustomerID").ForeignKeyConstraintName("none");

buried in the source is a check to ignore creation if the name is "none"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜