Entity Framework Common Issues

February 05, 2014

Problem: Unable to update model with new SQL View

Solution: 

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"

http://stackoverflow.com/questions/1013333/entity-framework-and-sql-server-view

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


http://stackoverflow.com/questions/14161277/after-updating-edmx-model-what-about-dbcontext

Problem : Duplicate rows in LINQ fetch via SQL View


Solution:


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


http://www.itworld.com/development/361338/linq-net-returning-duplicate-rows-working-sql-view-solved


You Might Also Like

0 comments

Popular Posts

Twitter