2

Note: This question is related to Migrations - EF Core with ASP.NET Core MVC

In the following I need only to change FY1 to FY2 in Display Annotation. Likewise, similar Display values at many places on our various models. Since schema is not changing I assume I do not need to run PM>Add-migration and PM>Update-Database commands again, correct?

**Model**
...
[Display(Name = "FY1 Total Revenue")]
public float? FY2Rev { get; set; }
...
Nick Albrecht
  • 16,607
  • 10
  • 66
  • 101
nam
  • 21,967
  • 37
  • 158
  • 332

1 Answers1

4

Per MSDN:

The Migrations feature enables you to change the data model and deploy your changes to production by updating the database schema without having to drop and re-create the database.

Specifically related to your question, changing the Display data annotation for a property will have zero influence on the database schema.. because why should the database care how you want to display the information? The only reason why you would have to run a migration is if you decided to change the actual property name. That type of change would have to be updated in your database in order to collect correct information since you changed your domain model.

Furthermore, changing property type will require you to do a migration because you're explicitly changing the property, specifically the type of the property. The database will need to know that change in order to collect the correct data.

I hope this helps.

Grizzly
  • 5,873
  • 8
  • 56
  • 109
  • How about changing property type? – nam Sep 01 '17 at 19:06
  • Changing property type will require you to do a migration because you're explicitly changing the property, specifically the `type` of the property. The database will need to know that change in order to collect the correct data. – Grizzly Sep 01 '17 at 19:28
  • Thanks. Could you please add that to your `Reply` as well - and I will mark your `Reply` as an `Answer` – nam Sep 01 '17 at 19:37
  • Changed my answer. – Grizzly Sep 01 '17 at 19:39
  • In case you have any comment on my this [post](https://stackoverflow.com/q/46006910/1232087) – nam Sep 01 '17 at 20:08