When using Entity Framework 4.1, are there alternatives to the naming conventions for Navigation Properties?
For example instead of doing this:
public virtual MyObject MyObject { get; set; }
To be
public virtual MyObject SomeOtherName { get; set; }
UPDATE:
When the [ForeignKey("OldStepId")] and [ForeignKey("NewStepId")] attribute is added, the generated SQL then becomes:
{SELECT
`Extent1`.`CompletedId`,
`Extent1`.`OldStepId`,
`Extent1`.`NewStepId`,
`Extent1`.`Name`,
`Extent1`.`Step_StepId`,
`Extent1`.`Step_StepId1`
FROM `Completed` AS `Extent1`}
which, the last two columns do not exist.
You can use the Data Annotations or the Fluent API to do this
Attribute Way
Fluent Way
RESPONSE TO UPDATE
If you have a List in your MyOjbect class, then you need to mark that List as
[InverseProperty("SomeOtherName")]. This might be why you are getting extra columns in your SQL. This keeps two-way relationships from being doubled up by telling the generator where the main column really is.