创建于EF4表和视图之间的一个一对一的关系? [英] Create One-To-One relationship between table and view in EF4?

查看:206
本文介绍了创建于EF4表和视图之间的一个一对一的关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表项(ITEMID INT PK,标题VC,VC描述)

我创建了一个名为ItemView控件测试视图:SELECT * FROM项目

我说这个观点我的模式,取消了所有的钥匙,但真正的关键,增加了一个1-1的关联,并映射它,但我得到2个错误:

  1. 在该表/视图dbo.ItemView没有定义主键。密钥已经推断和的定义创建为只读表/图。
  2. 错误3021:问题映射碎片开始行XXXX:每一个表项下的列映射到多个概念端属性: Item.ItemId被映射到 可能是什么问题?
解决方案

EDMX访问量处理器 - 一个修补程序针对此问题

I have a table Item (ItemId int PK, Title vc, Description vc)

I created a testing view called ItemView: SELECT * FROM Item.

I added this view to my model, removed all the keys but the real key, added a 1-1 association, and mapped it, but I get 2 errors:

  1. The table/view 'dbo.ItemView' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view.
  2. Error 3021: Problem in mapping fragments starting at line xxxx: Each of the following columns in table Item is mapped to multiple conceptual side properties: Item.ItemId is mapped to What can be the problem?

解决方案

Edmx Views Processor - a hotfix for this issue.

这篇关于创建于EF4表和视图之间的一个一对一的关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆