类型参数“POCO类”的ExecuteFunction来是由函数返回的类型“EFComplexType'不兼容 [英] The type parameter 'POCO Class' in ExecuteFunction is incompatible with the type 'EFComplexType' returned by the function

查看:725
本文介绍了类型参数“POCO类”的ExecuteFunction来是由函数返回的类型“EFComplexType'不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经得到了一个使用POCO代其类型的EF模型。我们增加了一个存储过程,并创建了一个函数导入它。然后,我们产生了复杂类型的结果集,让T4模板生成的商业合同(POCO)。

We've got an EF model that's using POCO generation for its types. We added a stored procedure and created a function import for it. We then generated a Complex Type for the result set and let the T4 template generate the business contract (POCO).

一切的伟大工程,在我们的发展,devint和QA环境。当我们部署到生产应用程序的工作了一段时间,然后开始抛出此异常:

Everything works great in our development, devint, and QA environments. When we deploy to production the application works for a while and then starts throwing this exception:

System.InvalidOperationException:该类型参数POCO的ExecuteFunction来是由函数返回的类型EFComplexType不兼容

如果我们回收应用程序池的例外消失了一小会儿,然后回来,所以我们再次回收应用程序池,等等...

If we recycle the application pool the exception goes away for a little while and then comes back, so we recycle the app pool again, and so on...

我们已无法重现该问题在其中使它很难确定根本原因不是产品以外的任何环境中。

We have been unable to reproduce the problem in any environment other than production which is making it very hard to determine the root cause.

我怀疑任何人有一个拍拍答案,但任何想法,以什么它的也许的进行,地方,我们可能想要探索,或者追查根源的想法将是有益的。

I doubt anyone has a pat answer to this, but any thoughts as to what it might be, areas we might want to explore, or thoughts on tracking down the root cause would be helpful.

推荐答案

我们终于想通了,是什么原因导致的问题。我们有这也是使用EF其他服务。它是用,挂落的ObjectContext的ExecuteStoreQuery方法。一旦这个方法被调用我们所有其他的EF查询开始失败,无论是上述消息或一个不兼容的元数据的消息。我们重写了该查询使用标准ADO.NET,并没有问题,因为。

We finally figured out what was causing the problem. We had another service that was also using EF. It was using the ExecuteStoreQuery method that hangs off the ObjectContext. As soon as that method was called all of our other EF queries started to fail with either the above message or an "incompatible metadata" message. We rewrote that query to use standard ADO.NET and haven't had a problem since.

这篇关于类型参数“POCO类”的ExecuteFunction来是由函数返回的类型“EFComplexType'不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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