Entity Framework 4.0 函数导入 - 为什么它没有在我的对象上下文中显示为方法?
我有一个存储过程,已映射到我的实体框架模型中(尝试执行我的第一个),并且我已指定函数导入。存储过程返回一个数据集作为结果,该数据集在我的函数导入中映射到复杂类型。我正在使用 VS.NET 2010。
我认为我已经完成了所需的所有典型操作,即 http://msdn.microsoft.com/en-us/library/bb896231.aspx。也没有模型错误。
为了能够调用我的函数导入,我还需要做些什么吗?还有其他人遇到过类似的问题吗?他们创建了一个返回复杂类型的函数导入,但它没有显示为 ObjectContext 中的可调用函数?如果没有,您是否可以建议我研究一些内容以便进一步调查?
编辑: 我只是使用实体框架直接执行方法直接执行存储过程, http: //msdn.microsoft.com/en-us/library/ee358758.aspx。好的部分是它仍然自动映射到我的复杂类型。虽然我很想使用函数导入方法...
谢谢
I have a stored procedure that I've mapped in my entity framework model (trying to do my first one), and I've specified a function import. The stored procedure returns a data set as the result, which is mapped to a complex type in my function import. I'm using VS.NET 2010.
I think that I've done all of the typical stuff required, i.e. like http://msdn.microsoft.com/en-us/library/bb896231.aspx. There are no model errors either.
Is there anything else that I need to do in order to be able to call my function import? Has anyone else had a similar issue where they've created a function import that returns a complex type, yet it didn't show up as a callable function from the ObjectContext? If not, is there anything that you may recommend I look into in order to further investigate?
Edit:
I'm just executing my stored procedures directly with the entity framework direct execution method, http://msdn.microsoft.com/en-us/library/ee358758.aspx. The nice part is it still auto-maps to my complex types for me. Although I would love to use the function import approach...
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终遇到了这个问题,并通过右键单击解决方案资源管理器中的 *.Context.tt 文件并选择“运行自定义工具”来修复它。
我必须做很多事情才能让更新显示在我的模型对象中。
I ended up with the problem and I fixed it by right-clicking on the *.Context.tt file in my Solution Explorer and choosing "Run Custom Tool".
I've had to do that a lot to get updates to show up in my model object.
它不会显示为
ObjectContext
上的方法,而是显示在派生生成的类上。如果您直接使用ObjectContext
,则必须使用ExecuteFunction
调用函数导入。It will not show as method on
ObjectContext
but on derived generated class. If you are usingObjectContext
directly you must call function import by usingExecuteFunction
.