【发布时间】:2016-10-11 15:06:49
【问题描述】:
我创建了必须使用FULL OUTER JOIN 的视图。
我想通过 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添加到视图。
【问题讨论】:
标签: sql-server entity-framework ef-database-first sql-view