不能添加欣赏到EDMX(cannot add view to the edmx)

   IT问题网   2019-08-21 00:00:00

问 题

当试图将视图添加到edmx文件,没有任何反应。
我用wxl编辑器中打开edmx文件,我发现了以下错误:

警告6013:表/视图 "cellularorders.dbo.v_link'不 定义主键和无 有效主键可以推断。 此表/视图已被排除。至 使用实体,则需要 检查您的模式,添加正确的 钥匙,并取消它。

(importent的事情 - 我没有,并不需要添加视图基于对edmx该表。此外,该视图仅适用于对数据做select语句。)

因此,在分贝,我更新了t_link表,并提出,反映了视图主键的领域之一。然后,当我再次tryed到视图添加到edmx没有再次发生。

我该如何解决这个问题? 是否有一个选项,以解决这一问题,而不做任何表? 我可以添加另一个观点,即会以某种方式包装与固定属性的旧观点,但?

解决方案

每个表或视图中添加到实体模型必须有一些关键的。它实际上不必是主键。如果表中没有定义的ef的主键将尝试推断使用简单规则的关键:它会采取所有非空的非计算非二进制列,将其标记为实体键。如果没有这样的列存在的实体不能被自动添加和设计者将引发提及的警告。解决方法是手动添加视图,并选择自己的关键,但一旦你这样做,你不能使用的更新从数据库的,因为它总是会覆盖您的更改。

您定义的关键应该是唯一的,否则你可以有相关的一些其他问题,<一个href="http://stackoverflow.com/questions/3653009/entity-framework-and-connection-pooling/3653392#3653392">identity地图内部使用。

标签:不能添加欣赏赏识



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

目前已经在IP端点0.0.0.0:13000监听器。 ? (TCP使用WCF)(There is already a listener on IP endpoint 0.0.0.0:13000. (TCP using WCF))

problem i'm trying to figure out why the port is being us ...

这是使用System.Security.Principal.WindowsIdentity的合理的安全?(Is this use of System.Security.Principal.WindowsIdentity reasonably secure)

problem is system.security.principal.windowsidentity reas ...

C#拖放放大器;从列表框中下降到TreeView控件(C# Drag &amp; drop from listbox to treeview)

problem i have a winform with a listbox and a treeview. ...

C#检查远程服务器(C# Check Remote Server)

problem can anyone advise what the best way to check (usi ...

如何获取数字HTTP状态codeS在PowerShell中(How to obtain numeric HTTP status codes in PowerShell)

problem i know of a few good ways to build web clients in ...

反映从基类的私人领域(Reflecting a private field from a base class)

problem here is the structure: myclass : superclass2 su ...

除通过JavaScript来本地磁盘作为.png文件渲染SVG图像(Save svg image rendered by a javascript to local disk as .png file)

problem i am new to svg and not an advanced user of javas ...

单元测试System.Timers.Timer的(unit testing system.timers.timer)

problem i've been reading over the questions about unit t ...

为什么String.IsNullOrEmpty比string.length减得快?(Why is String.IsNullOrEmpty faster than String.Length)

problem ilspy shows that string.isnullorempty is implemen ...

ASP.NET例外&QUOT;正在中止线程&QUOT;导致方法退出(ASP.NET exception &quot;Thread was being aborted&quot; causes method to exit)

problem in the code below, sometimes somefunc ...

如何通过在磁盘上真正大文件扫描?(How to scan through really huge files on disk)

problem considering a really huge file(maybe more than 4g ...

字符串和垃圾收集(Strings and Garbage Collection)

problem i have heard conflicting stories on this topic an ...

在C#中如何蚕食(半字节)字节?(How can you nibble (nybble) bytes in C#)

problem i am looking to learn how to get two ...

ASP.NET网站内存使用率相当高(ASP.NET Website Memory Usage quite high)

problem i have an asp.net website that will h ...

在.NET 4.0中,什么是对的Equals值类型的默认实现?(In .NET 4.0, What is the default implementation of Equals for value types)

problem the two documentation pages seem to contradict on ...

如何确定文件是否在.NET中的图像文件?(How can I determine if a file is an image file in .NET)

problem i don't want to rely on the file exte ...

关于反映在.NET一个很好的和完整的教程?(A good and complete tutorial about reflection in .NET)

problem the question almost says it all. i th ...

如何签署ClickOnce应用程序(How to sign a ClickOnce application)

problem i have a clickonce application that i ...

防爆pression的类型成员产生不同的防爆pressions(MemberEx pression,UnaryEx pression)(Expression for Type members results in different Expressions (MemberExpression, UnaryExpression))

problem i have a expression to point on a property of m ...

流包装,使流可查找?(Stream wrapper to make Stream seekable)

problem i have a readonly system.io.stream implementation ...