I've got a class CurrentPage which has a Page property, and it's an enum (of type int):
namespace App.Model.Application
{
using System.Runtime.Serialization;
/// <summary>
/// Represents user the current page of a user in the application
/// </summary>
[DataContract]
public class CurrentPage
{
/// <summary>
/// Gets or sets the unique identifier for this current page.
/// </summary>
[DataMember]
public int Id { get; set; }
/// <summary>
/// Gets or sets the description
/// </summary>
[DataMember]
public string Description { get; set; }
/// <summary>
/// Gets or sets the identifier of the current page to which the user has navigated.
/// </summary>
[DataMember]
public Page Page { get; set; }
/// <summary>
/// Gets or sets the current page as an integer; this is to support Entity Framework limitations regarding enumerations.
/// </summary>
public int PageId
{
get
{
return (int)this.Page;
}
set
{
this.Page = (Page)value;
}
}
}
}
It's mapped like this:
this.Property(cp => cp.Page).IsRequired();
If I try to run Add-Migration in VisualStudio, I end up getting this in my migration code
RenameColumn(table: "dbo.CurrentPage", name: "Page1", newName: "Page");
I don't understand where this 'Page1' name is coming from. There's no Page1 column in the database.
Any ideas? Could it be creating the Page1 column because it somehow thinks the Page column that's already there isn't suitable for being mapped to that property?