If you try to build a WCF RIA Application and the Entity Model (EM) doesn’t include foreign key information you will get an error like:
Unable to retrieve association information for association ‘MyModel.MyAssociation’. Only models that include foreign key information are supported. See Entity Framework documentation for details on creating models that include foreign key information.
There are three ways to get around this error.
- If you are creating the model from a database, be sure to check the “Include foreign key columns in the model” setting when generating the model from the database.
- If you are creating a model and will generate the database from the model and you are not creating a 1 to many association, then you have to double click on the association in the model. This will bring up the Referential Constraint editor and allow you to add the foreign key details.
- If you are creating a model and will generate the database from the model and you are creating a 1 to many association, you can check the “Add foreign key properties to the ‘MyObject’ Entity” setting when generating the association between the tables.
You can read all of the breaking changes in 4.0 in this document.
Some of this information is also talked about here.