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

前端 未结 1 1513
孤城傲影
孤城傲影 2020-12-09 18:04

I have a mapping like this:

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

Which is causing a constraint like this to be generated by

相关标签:
1条回答
  • 2020-12-09 18:46

    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 讨论(0)
提交回复
热议问题