简体   繁体   English

如何最好在Entity Framework中重命名引用?

[英]How should I rename a reference in Entity Framework best?

I know that it is an absolute beginner question but how should I rename references in EF? 我知道这是一个绝对的初学者问题,但是如何在EF中重命名引用?

Let you know, I have two simple tables they have a reference: 让您知道,我有两个简单的表,它们有一个参考:

Product and Subproduct. 产品和子产品。

在此处输入图片说明

In my sql DataBase, the reference key is called "subproducts_ibfk_1" and the EF named it in "product1". 在我的sql数据库中,引用键称为“ subproducts_ibfk_1”,EF在“ product1”中将其命名。 How are you handle this? 您如何处理?

Best regards 最好的祝福

This really depends on your preference or your company's standard. 这实际上取决于您的偏好或公司的标准。 The "standard" for SQL Server is sometimes FK_ForeignKeyTable_PrimaryKeyTable. SQL Server的“标准”有时是FK_ForeignKeyTable_PrimaryKeyTable。 So your example would be FK_subproduct_product. 因此,您的示例将是FK_subproduct_product。

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

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