LINQPad error: 'UserQuery': cannot derive from sealed type 'My.Entity.Framework.CustomDataContext'

守給你的承諾、 提交于 2019-12-19 19:52:52

问题


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.

The error is:

'UserQuery': cannot derive from sealed type 'My.Entity.Framework.CustomDataContext'

Any ideas on how to get this working again? I can find no mention of this error online.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/11915805/linqpad-error-userquery-cannot-derive-from-sealed-type-my-entity-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!