我是 .NET 的新手。我想创建一个包含 3 列的表,每个列对应 Libro 实体的每个属性,但是创建表时它只有两列,id 和 Titulo,没有我的导航属性“Comments”
这是实体
public class Libro
{
public int id { get; set; }
[Required]
public string Titulo { get; set; }
public List<Comment> Comments { get; set; }
}
这是迁移文件
migrationBuilder.CreateTable(
name: "Libros",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Titulo = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Libros", x => x.id);
});
你能帮帮我吗,我做错了什么?谢谢你
没有数据库列表结构这样的东西,它是您创建的关联结构,点击链接了解更多详细信息。