If you want to rename them only to code and leave db the same, just change the names and names of entity objects:
What you describe sounds as if your classes and properties are called differently from your tables:
[Table("X", Schema = "MYSCHEMA")]
public class Y
{
[Column("X_ID"), Key]
public int Y_ID { get; set; }
public virtual List<X> X { get; set; }
}
[Table("Y", Schema = "MYSCHEMA")]
public class X
{
[Column("Y_ID"), Key]
public int X_ID { get; set; }
[Column("X_ID"), Key]
public int Y_ID { get; set; }
[ForeignKey("X_ID")]
public virtual Y Y { get; set; }
}
You can simply rename your classes and properties according to the names of tables and columns as follows:
[Table("X", Schema = "MYSCHEMA")]
public class X
{
[Column("X_ID"), Key]
public int X_ID { get; set; }
public virtual List<X> Y { get; set; }
}
[Table("Y", Schema = "MYSCHEMA")]
public class Y
{
[Column("Y_ID"), Key]
public int Y_ID { get; set; }
[Column("X_ID"), Key]
public int X_ID { get; set; }
[ForeignKey("X_ID")]
public virtual X X { get; set; }
}
Brino source
share