Entity Framework - not have a primary key defined

Condition :
Add ADO.NET Entity Data Model > Right click >  update Model from database > pick table/view

VS Output:
The model was generated with warnings or errors.
Please see the Error List for more details. These issues must be fixed before running your application.

Open edmx file with XML editor have error :








Solution:


SELECT ISNULL((ROW_NUMBER() OVER (ORDER BY column1 DESC)), 0) AS ‘ID’, column1, column2
FROM  dbo.sample


 


Reference link :
http://www.hilmiaric.com/?p=95
http://www.ericsdavis.net/index.php/2009/03/14/entity-framework-and-primary-key-inference/
http://stackoverflow.com/questions/745341/can-sql-server-views-have-primary-and-foreign-keys

沒有留言:

張貼留言