I am trying to add a view to an entity data model but I get the error below. The view is a group by with a count. I don’t understand this because a view does not have a primary key by it’s nature.
I modified the original post because I figured out how to add a key to the view. But I still have the same problem.
warning 6013: The table/view 'fmcsa.dbo.vieFMCSADocumentCount' 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.
Here is the View
CREATE VIEW [dbo].[vieFMCSADocumentCount] with SCHEMABINDING
AS
SELECT COUNT_BIG(*) AS CountOfDocs, ROLE_ID, OWNER_ID
FROM dbo.FMCSA_DOCUMENT
GROUP BY ROLE_ID, OWNER_ID
then I can add a key
CREATE UNIQUE CLUSTERED INDEX [MainIndex] ON [dbo].[vieFMCSADocumentCount]
(
[OWNER_ID] ASC,
[ROLE_ID] ASC
)
Still not working.