This section is here several times, but there is no answer, give me an option on how to avoid this problem in EF.
My warning:
Warning Error 6002: Table / View 'ADContainersWithEnvironmentsView' does not have a primary key. This key was inferred, and the definition was created as a table / read-only view.
I mainly use the first database approach with EF in my project.
I have a view:
CREATE VIEW [dbo].ADContainersWithEnvironmentsView AS WITH ADContainerWithEnvironments(Id, LinkedEnvironmentId) AS ( SELECT adc.Id, adc.LinkedEnvironmentId FROM ADContainer AS adc WHERE ParentAdContainerId IS NULL UNION ALL SELECT subAdc.Id, parentAdc.LinkedEnvironmentId FROM ADContainer AS subAdc INNER JOIN ADContainerWithEnvironments parentAdc ON subAdc.ParentAdContainerId = parentAdc.ID ) SELECT ISNULL(Id,-1) AS Id, LinkedEnvironmentId FROM ADContainerWithEnvironments
As explained in other topics, I need to specify PK in my view using ISNULL (Id, -1) AS Id
I also mark my Identifier as an Entity Key in the Chart to check my screenshot 
I have this warning for all my 10 views. After my changes, I will close my visual studio, even restart the computer or try on another computer :), but there is still a warning.
Thanks for the help.
source share