首页 > 解决方案 > 使用迁移将表添加到数据库

问题描述

我对模型进行了一些更改,其中包括向类添加新字段并创建新类(表),如下所示:

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using Newtonsoft.Json;

namespace SurveyTool.Models
{
    public class Industry
    {
        [Key]
        public int ID { get; set; }

        public string name { get; set; }

    }
}

当 IAdd-MigrationUpdate-Database时,添加了新字段。但是,新表不是。我再次尝试了这个过程,最新的迁移是空的。

为什么添加新表的标准流程不起作用?

谢谢!

标签: asp.net-mvclinq

解决方案


推荐阅读