I am using EF6 to access a set of three tables "TableA", "TableB" and "TableC" TableA has a many to many relationship with TableB and TableC so there are two tables that were created TableATableB & TableATableC. These tables had two columns in each,i.e. TableA_Id and TableB_Id or TableA_Id and TableC_Id. This works but now the DBA wants me to remove the underscore character from those columns.
While the original tables was created with migrations I have since removed the migrations aspect from the project. I have renamed the columns in the actual join tables but how do I get the relationship back to TableA to work? Is it possible via data annotations or fluent?
TableA:
public class TableA
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public virtual ICollection<TableB> TableBs { get; set; }
public virtual ICollection<TableC> TableCs { get; set; }
}
TableB:
public class TableB
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<TableA> TableAs { get; set; }
}
TableC:
public class TableC
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<TableA> TableAs { get; set; }
}
This is different then previous questions because it specifies that the join table is already created and has specific column names. The problem is how to get existing code to map to the correct column
names.