简体   繁体   English

如何关闭实体框架创建外键

[英]How to close Entity Framework create foreign key

I use Entity Framework.6.1.3. 我使用实体框架6.1.3。 I want Entity Framework to not create foreign key in SQL Server database. 我希望实体框架不要在SQL Server数据库中创建外键。 What configuration can be set? 可以设置什么配置?

I tried this but it only disables foreign key, it still creates it: 我试过了,但是它只禁用外键,它仍然创建它:

modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();

Is there a way to tell Entity Framework not to create the foreign keys it in database? 有没有办法告诉实体框架不要在数据库中创建外键?

我建议您看看EntityForeinkey对于您的问题,希望对您有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM