I'm using Asp.Net Core 2.1, Mvc, c#, EF Core with Code First and Migrations.
I'm trying to build a table that has a composite primary key in the Migration.Up()
method:
migrationBuilder.CreateTable(
name: "TagValueAttributes",
columns: table => new {
TagValueID = table.Column<Int64>(nullable: false),
Identifier = table.Column<string>(nullable: false, unicode: true, maxLength: 256),
Value = table.Column<string>(nullable: true, unicode: true, maxLength: 2048)
},
constraints: table => {
table.PrimaryKey(
name: "PK_TagValueAttributes",
columns: // what goes here???
)
}
);
I don't know what to specify for the columns
parameter of the constraints
table.PrimaryKey()
call. I would like columns TagValueID
, and Identifier
to form the composite key.
What do I need to specify for the columns
parameter?
table
calledTagValueID
not one calledIdentifier
. – Emlen