I have this entity in my EF code First
public class Equipment
{
public Int64 Id { set; get; }
public string Name { set; get; }
public string Model { set; get; }
public string Factory { set; get; }
public DateTime SubmitDateTime { set; get; }
public GUID OrganizationId { set; get; }
}
I changed it to
public class Equipment
{
public Int64 Id { set; get; }
public string Name { set; get; }
public string Model { set; get; }
public string Factory { set; get; }
public DateTime SubmitDateTime { set; get; }
public Int64 OrganizationId { set; get; }
}
but after running i get this error:
An exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.dll but was not handled in user code
Additional information: Operand type clash: uniqueidentifier is incompatible with bigint
here my migration method:
public class MigrationsConfiguration : DbMigrationsConfiguration<DataContext>
{
public MigrationsConfiguration()
{
this.AutomaticMigrationDataLossAllowed = true;
this.AutomaticMigrationsEnabled = true;
}
}
I have lots of data in my Db .So i can't remove it to generate it again.so how can i fix this error ?
With three steps i changed it : first I added another column to my entity
public GUID OrganizationId { set; get; }
public int64 OrganizationId2 { set; get; }
second I removed the guid column in my entity
public int64 OrganizationId2 { set; get; }
last step finally i renamed my new column
public int64 OrganizationId { set; get; }