问题
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