问题
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
?
回答1:
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.
来源:https://stackoverflow.com/questions/17243088/linqpad-test-looks-for-correct-db-but-queries-wrong-one