8

I use Entity Framework Code First.

At this time I have the following model:

public class MaterialEditNewViewModel
{
    public int RequestID { get; set; }
    [Required]
    public double? Quantity { get; set; }
    [Required]
    public MaterialWorthEnumViewModel? MaterialWorth { get; set; }
    ...
}

Where MaterialWorthEnumViewModel is:

public enum MaterialWorthEnumViewModel
{
    [Display(Name = "< 1.000€")] LessThan1000,
    [Display(Name = "1.000€ < 10.000€")] Between1000And10000,
    [Display(Name = "10.000€ < 100.000€")] Between10000And100000,
    [Display(Name = "100.000€ < 1.000.000€")] Between100000And1000000,
    [Display(Name = "1.000.000€ < 10.000.000€")] Between1000000And10000000,
    [Display(Name = "10.000.000€ < 25.000.000€")] Between10000000And25000000,
    [Display(Name = "> 25.000.000€")] GreaterThan25000000
}

I need to change this enum with a double type (99999.99).

I am aware that my database will be inconsistant on this property (data before/after change) if I change the type but that's another problem.

My question is: does EF Code First migration allows me to change the type and propagate this change on the production server when published?

Thanks.

Bronzato
  • 9,438
  • 29
  • 120
  • 212

0 Answers0