我已经创建了必须使用FULL OUTER JOIN
的视图。如何在VIEW中使用OUTER JOIN创建PRIMARY KEY
我想用DbFirst方法在EDMX
中使用这个视图。
但EDMX
正在产生下一个警告:
<!--Errors Found During Generation: warning 6013: The table/view 'MyView' 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.
我试图通过添加 CREATE UNIQUE CLUSTERED INDEX PK_MyView ON [dbo].[MyView] (Id)
解决这个但SQL说: Cannot create index on view "dbo.MyView" because it uses a LEFT, RIGHT, or FULL OUTER join, and no OUTER joins are allowed in indexed views. Consider using an INNER join instead.
有没有一种方法来添加视图,而不PK把edmx或PK添加到视图中。
我需要索引视图,因为实体框架需要它。索引我的意思是索引作为公钥。 –