We are updating a project from Entity Framework 4 to Entity Framework 6. We use database first mapping. When we originally built the project we renamed many navigation properties in the entity model to improve the semantics of the property names.
When we updated to Entity Framework 6, the .edmx schema had changed, so we recreated all of the name changes. Unfortunately, at the first database access, Entity Framework throws this exception:
System.Data.Entity.Core.MetadataException was unhandled by user code
HResult=-2146232007
Message=Schema specified is not valid. Errors:
The relationship 'web_appModel.fk_service_order_workorder_id' was not loaded because the type 'web_appModel.workorder' is not available.
The following information may be useful in resolving the previous error:
The required property 'asset' does not exist on the type 'Persistence.Interface.workorder'.
Our model has a service_order table with a foreign key to a workorder table with a foreign key to an asset table. The navigation property in the workorder object was originally called asset, but we renamed it.
The problem in this case is that Entity Framework can't load a relationship a to b because because a navigation property in a relationship b to c has a changed name.
The data is in a PostgreSql database. We use DevArt DotConnect as the Entity Framework provider.