[英]How to add columns to an existing SQL Server 2008 database table in asp.net MVC 3
I'm looking to add 2 columns to an existing table in my SQL Server 2008 database. 我正在向SQL Server 2008数据库中的现有表添加2列。 I'm coming in on a poorly documented project, so I wondering, is it simply a case of adding to the class and entering add migration?
我要参加一个文档记录不充分的项目,所以我想知道,这仅仅是添加到类并输入添加迁移的一种情况吗?
The class is within an Entities
folder in a Models
project and the class uses the following attribute.. 该类位于
Models
项目的Entities
文件夹中,并且该类使用以下属性。
[PersistableEntitiesAttribute]
The properties are written as... 属性写为...
public virtual string Username { get; set; }
Can I add two virtual properties to the class and use the PM to add migration? 我可以在类中添加两个虚拟属性并使用PM添加迁移吗?
Please note I am seeking to keep all data already in the Database and there is no migrations folder in this project. 请注意,我正在寻求将所有数据保留在数据库中,并且此项目中没有Migrations文件夹。
Asp.net MVC 3 application. Asp.net MVC 3应用程序。
Is there steps I follow to complete this task ? 我需要执行以下步骤来完成此任务吗?
Not sure if it's the correct way but I simply added the two virtual properties to my class.. 不知道这是否是正确的方法,但我只是将两个虚拟属性添加到类中。
public virtual string ResetToken { get; set; }
public virtual DateTime? ExpirationDateTime { get; set; }
and then added the same properties manually to the table in the database through the design view. 然后通过设计视图将相同的属性手动添加到数据库中的表中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.