Attempting to use EF Core with LinqPad getting unable to case to DbContext
I am using EF Core 2.0.3 in an application. I can create a connection to the database using the DbContext DLL and the constructor that takes a connection string. The test button says everything is working. However, in the connection list I am getting the error: "Unable to cast object of type "...GorillaSyncDbContext" to type "Microsoft.EntityFrameworkCore.DbContext".
That type is definitely inherited from Microsoft.EntityFrameworkCore.DbContext. I have added the Nuget Package for Microsoft.EntityFrameworkCore v2.0.3 and Microsoft.EntityFrameworkCore.SqlServer v2.0.3 to LinqPad (or maybe just to the query). This caused no change.
What am I missing?
Thanks in advance for any advice.
That type is definitely inherited from Microsoft.EntityFrameworkCore.DbContext. I have added the Nuget Package for Microsoft.EntityFrameworkCore v2.0.3 and Microsoft.EntityFrameworkCore.SqlServer v2.0.3 to LinqPad (or maybe just to the query). This caused no change.
What am I missing?
Thanks in advance for any advice.
Comments
However, if I do TableName.Dump() I do get results back. Most, but not all, of the fluent methods appear to work against the database. Strangely for some tables I get the cast error and not others. I haven't seen a clear pattern.
Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
The list was too long to paste here, so I put it in this Google Doc: https://docs.google.com/document/d/1vEmWhuRQm020p5OLwrH4olUX3QdXmh4BlWEpdzVOBqE/edit?usp=sharing
For reference, I have also listed the DLLs that I see in a new, unattached, LinqPad document. There is no anonymous assembly and your original code works fine there.
Not sure why the image isn't showing up, here's the bare link:
https://drive.google.com/file/d/1lZM9NRwLRJRmDQapFudXRuHzYBlZejXh/view?usp=sharing