问题
I'm writing a small business Winforms application in C#, .NET 4.0, using Entity Framework to query database.
I used SQL Server CE 3.5 as my database and this specific (exactly the same) query executed really fast (didn't measure it, but I didn't notice any delay). Then I switched to SQL Server CE 4.0 and I tested it on the same query and it needed around 4 seconds to execute.
Am I doing something wrong or maybe SQL Server CE 4.0 wasn't meant to be used in Winforms, or...?
Should I just switch back to SQL Server CE 3.5?
Thank you for your answers and time.
EDIT:
My model is very basic, as I am quite early in the development phase.

My query is absolutely simple:
ObjectQuery<Location> locationsQuery = mainDBContext.Locations;
Also the table holds under 10 records.
回答1:
It seems that where I use SQL CE 4.0, this was my first query, which is why it took so much time.
Ah, well, when you write about your problem it seems to help you.
/me ashamed
来源:https://stackoverflow.com/questions/9674177/sql-server-ce-4-0-entity-framework-query-runs-realy-slow-compared-with-sql-ser