简体   繁体   中英

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. 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..

 [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?

Please note I am seeking to keep all data already in the Database and there is no migrations folder in this project.

Asp.net MVC 3 application.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM