SQL Server CE 4.0 Entity Framework, query runs realy slow (compared with SQL Server CE 3.5)

 ̄綄美尐妖づ 提交于 2019-12-12 04:06:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!