问题描述
我试图遵循此将存储过程映射到自定义实体,但是当我这样做时,我可以不能在VS 2008设计器中打开EDMX文件。
似乎引起了一些问题。
I tried to follow this link to map stored procedures to Custom Entities, but when I did so I could no open the EDMX file in the VS 2008 designer.so looks like it is causing some issues.
有人知道如何将存储过程结果映射到Entity Framework中的自定义实体吗?
Does anyone know how to map Stored procedure results to custom Entities in Entity Framework?
推荐答案
在VS2010和EF4中,这非常容易做到。
执行函数导入时,还有一个附加选项可用于将集合作为复杂类型返回。更好的是,添加功能导入对话框底部有一个功能@,它将尝试从存储的过程结果集中获取列。最后,它使您可以选择根据结果集执行一键式创建新复合体类型。似乎EF团队认为这很痛苦,并采取了所有必要步骤使其变得更容易。
In VS2010 and EF4 this is extremely easy todo.When you do a function import it there is an extra option for returning the collection as a complex type. Even better there is a feature @ the bottom of the 'Add Function Import' dialog that will attempt get the columns from the stored proc result set. Finally, it gives you the option todo a one-click 'Create New Complex' type based upon the result sets. It appears the EF team saw this as a pain and took all necessary steps to make this easier.
我们有一个即将开始的大型项目( 30位以上的开发人员,需要2年以上的时间才能完成)。我们正在权衡使用标准ADO.Net,EntityFramwork或LLBLGen之类的第三方ORM的选项。到目前为止,我们看到的是Entity Framework 4版本是功能更强大的ORM。我会非常怀疑@在VS2008中使用EF,主要是因为您在本文中谈论的问题+ EF如何处理VS2008版本中的FK()
We have a large project that we are about to start on (large meaning 30+ developers and taking 2+ years to complete). We were weighing the options of using standard ADO.Net, EntityFramwork, or a 3rd party ORM like LLBLGen. What we are seeing so far is that the Entity Framework 4 release is a much more full featured ORM. I would be very skeptical @ using EF in VS2008 mostly because of the issue you are talking about in this post + how EF handled the FK's in the VS2008 release (http://blogs.msdn.com/efdesign/archive/2009/03/16/foreign-keys-in-the-entity-framework.aspx)
这篇关于实体框架3.5,将存储过程结果映射到自定义实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!