在我的sql表中,我无法为视图设置主键。当我尝试编译我的项目时,我总是得到他的错误。有没有办法在sql server中设置主键,或者 在Visual Studio中使这个错误消失了吗?
警告2错误6002:表/视图“db.dbo.View_Customer_Active”没有定义主键。已推断密钥,并将定义创建为只读表/视图。 C:\ Users \ Documents \ Visual Studio 2013 \ Projects \ Proj1 \ Proj1 \ Models \ DB.edmx
答案 0 :(得分:1)
这不是错误,只是一个警告,告诉您无法更新和删除视图中的项目。没有主键的视图在实体框架的上下文中是一种常见问题:
Entity Framework: View exclusion without primary key或 Entity Framework and SQL Server View