实体框架——“System.StackOverflowException”类型的未处理异常发生在 System.Data.Entity.dll 中——为什么?

发布于 2024-11-26 12:28:48 字数 637 浏览 1 评论 0原文

我正在尝试使用实体框架来制作问卷。我根本无法加载问卷模型——每个模型都失败并出现 stackoverflowException。

我在其他 EDMX 文件中还有其他模型,到目前为止它们工作得很好。

QuestionEntities qc = new QuestionEntities(); System.Data.Objects.ObjectSetqvs = qc.FormViews;

溢出发生在第二行。

据我所知,它们都设置为延迟加载,因此它不应该尝试加载整个数据库。为了以防万一,我尝试删除所有递归导航属性,但它仍然失败。

我发现的唯一类似条目是 C# - Entity Framework - mscorlib.dll 中发生了类型为“System.StackOverflowException”的未处理异常

不幸的是,只有通过反复重新启动 EDMX 才能解决这个问题(我已尝试过这样做) 出色地)。

任何帮助将不胜感激,谢谢

I am trying to use entity framework to make a questionairre. I cannot get the questionairre models to load at all -- each fails with a stackoverflowexception.

I have other models in other EDMX files, and they have worked fine so far.

QuestionEntities qc = new QuestionEntities();
System.Data.Objects.ObjectSet<FormView> qvs = qc.FormViews;

The overflow happens on the second line.

As far as I can tell, they are all set for lazy load, so it should not be attempting to load the entire DB. Just in case it has, I attempted to remove all recursive navigation properties, but it still fails.

The only similar entry I have found is C# - Entity Framework - An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

Unfortunately, that one was only solved through repeatedly restarting the EDMX (which I have tried as well).

Any help would be appreciated, thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

灵芸 2024-12-03 12:28:48

请检查您生成的代码,您可能有一些递归属性定义,这可能会导致问题。堆栈溢出仅发生在最终陷入无限循环的递归调用中。

如果您发布模型和生成的代码,那么很容易找到问题原因。

当存在递归包含在搜索中的表时,我们确实遇到了同样的问题,例如考虑像文件系统这样的树形结构,其中目录包含子目录,此类导航属性无法包含并导致堆栈溢出。

Please look into your generated code, you may have some recursive property definition which may cause the problem. Stack Overflow only occurs in recursive call that ends up in endless loop.

If you post your model and generated code, then it will be easy to find cause of problem.

We did have same problem when there were tables that were recursively included in search, for example consider a tree kind of structure like file system, where directory contains children which are directories, such navigation properties fail to include and results in stack overflow.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文