ForeignKeyAttribute(String) Constructor

Definition

Initializes a new instance of the ForeignKeyAttribute class.

public:
 ForeignKeyAttribute(System::String ^ name);
public ForeignKeyAttribute (string name);
new System.ComponentModel.DataAnnotations.Schema.ForeignKeyAttribute : string -> System.ComponentModel.DataAnnotations.Schema.ForeignKeyAttribute
Public Sub New (name As String)

Parameters

name
String

The name of the associated navigation property, or the name of one or more associated foreign keys.

Remarks

If you add the ForeignKey attribute to a foreign key property, name should specify the name of the associated navigation property. If you add the ForeignKey attribute to a navigation property, name should specify the name of one or more associated foreign keys. If a navigation property has multiple foreign keys, use commas to separate the list of foreign key names. For more information, see Code First Data Annotations.

Applies to