问题描述
LINQPad突然开始不能运行使用实体框架集查询。一切似乎是为了,所以我有点困惑,为什么它不工作。我的应用程序工作正常。
LINQPad has suddenly started failing to run queries using an Entity Framework assembly. Everything seems to be in order, so I'm a bit confused why it's not working. My app works fine.
该错误是:
UserQuery:不能从密封型派生My.Entity.Framework.CustomDataContext
这是怎样把身上该工作任何想法?我能找到没有提及这一错误的网络。
Any ideas on how to get this working again? I can find no mention of this error online.
推荐答案
UserQuery
是包含code在LinqPad类型。如果您使用自定义实体框架的背景下,从自己的汇编,UserQuery继承这个上下文类。但是,在你的情况看来,您的自定义EF上下文类是密封的,所以你不能从它继承。
UserQuery
is the type that contains your code in LinqPad. If you use a custom Entity Framework context from your own assembly, UserQuery inherits from this context class. But in your case it seems that your custom EF context class is sealed, so you can't inherit from it.
如果由于某种原因,你不能开封它,不要尝试使用LinqPad数据连接系统;只是引用的程序集包含您的EF背景下,明确创建上下文的实例。
If for some reason you can't "unseal" it, don't try to use the LinqPad data connection system; just reference the assembly containing your EF context and create an instance of the context explicitly.
这篇关于LINQPad错误:“UserQuery”:不能从密封型派生“My.Entity.Framework.CustomDataContext”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!