Entity Framework Common Issues

February 05, 2014

Problem: Unable to update model with new SQL View


Check the messages under Error List tab. If the message says "primary key is not defined" and "unable to infer primary key", make sure you have a primary key on the table. Simply, you may add ISNULL(ROW_NUMBER() OVER( ORDER BY ID), <value>) as PrimaryKey to your SQL View. 
*Please make sure you click "Run custom tool"

Problem: Intellisense is not  working for updated model or Updating model doesn't reflect in DB Context

Solution: Please make sure you click "Run custom tool

Problem : Duplicate rows in LINQ fetch via SQL View


Make sure your inferred primary key is really unique.  Add ROW_NUMBER() OVER( ORDER BY ID) as PrimaryKey to your SQL View

Popular Posts