Codeacula
Codeacula

Reputation: 2368

LinqPad Test Looks For Correct DB But Queries Wrong One

I have created a connection in LINQPad that uses a project's EfDBContext. After some recent issues I can now get it to query a table, but when it does it created a whole new schema.

So, when creating the connection (Entity Framework POCO Connection), when I click "Test" the Profiler shows me:

SELECT Count(*) FROM sys.databases WHERE [name]=N'mydatabase'

But when I run Ethnicities.Take (100) I see:

SELECT Count(*) FROM sys.databases WHERE [name]=N'UserQuery'

Followed by all the commands to generate the schema. What am I doing wrong or need to change to get it to read the data in mydatabase?

Upvotes: 0

Views: 136

Answers (1)

Codeacula
Codeacula

Reputation: 2368

I found this:

http://forums.oreilly.com/topic/49460-linqpad-entity-framework-41-poco-query-problem/

And adding this line of code in my DbContext file fixed it:

public EfDbContext() : base("mydatabase") { }

Unsure if this is still a known bug or an issue with me, since I tried the beta and still had the same issue.

Upvotes: 1

Related Questions