实体框架不会创建所有列 - 代码优先

问题描述 投票:0回答:1

我想创建一个包含 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);
                });
c# .net oracle entity-framework
1个回答
0
投票

没有数据库列表结构这样的东西,它是您创建的关联结构,点击链接获取更详细的信息。

© www.soinside.com 2019 - 2024. All rights reserved.