Linq : problem with primary key
- by Nickson
I get the following error message
The table/view 'TABLE1' does not have
a primary key defined and no valid
primary key could be inferred. This
table/view has been excluded. To use
the entity you will need to review
your schema, add the correct keys and
uncomment it
when I try to add a view to an Entity Data Model. For testing, I have created a very simple view and I still get the error. below is the view definition
SELECT
DISTINCT TOP (100) PERCENT
MIN(id) AS Expr4, MIN(EmpNo) AS Expr1,
MIN(Name) AS Expr2, MIN(Category) AS Expr3
FROM dbo.MYView1
GROUP BY id
does any one know of a simple work around.
I have looked at this thread http://stackoverflow.com/questions/745341/can-ms-sql-views-have-primary-and-foriegn-keys but in my scenario, what is recommended is not applicable.
If I could only have the view added to the Model.