sql-server-ce-4

DbSet.Find method ridiculously slow compared to .SingleOrDefault on ID

天涯浪子 提交于 2019-12-17 07:14:52
问题 I have the following code (Database is SQL Server Compact 4.0): Dim competitor=context.Competitors.Find(id) When I profile this the Find method takes 300+ms to retrieve the competitor from a table of just 60 records. When I change the code to: Dim competitor=context.Competitors.SingleOrDefault(function(c) c.ID=id) Then the competitor is found in just 3 ms. The Competitor class: Public Class Competitor Implements IEquatable(Of Competitor) Public Sub New() CompetitionSubscriptions = New List(Of

SQL Server CE 4.0 - DbUpdate Exception was unhandled

喜欢而已 提交于 2019-12-13 20:53:24
问题 I am struggling with SQL Server CE 4.0 almost all day. I get this error when I try to save new record (entity) to my database. First a little preview - I installed SQL Server CE 4.0 via NuGet and I created a database for my project. Then I created the Entity Framework model layer and started working with that. When I get this error my inner exception says this : The column cannot be modified. [ Column name = Id ] I did a little research and find out that this may be cause because of my

Unable to load the native components of SQL Server Compact

微笑、不失礼 提交于 2019-12-13 11:55:10
问题 I've installed SQL Server Compact Edition 4.0 on Win7 x64 and it runs both for Asp.Net and Desktop Applications. This PC also have Visual Studio 2010 SP1 installed. But my Server 2008 R2 produces following error for Asp.Net applications, although it can run Desktop Applications: Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details. I've

SQL Ce 4 - How can I run DBCC CHECKIDENT

南笙酒味 提交于 2019-12-12 06:03:52
问题 I want to run DBCC CHECKIDENT on a SqlCe4 database but it wont let me. I need to reset the identity column as its messed up. I think because IDENTITY was turned off, an import of data was done and then IDENTITY turned on again so I guess its out of sync 回答1: There is no DBCC CHECKIDENT in SQL CE 4. You need to use ALTER TABLE. ALTER TABLE [MyTable] ALTER COLUMN [IdentityColumn] IDENTITY (999,1). 来源: https://stackoverflow.com/questions/6284485/sql-ce-4-how-can-i-run-dbcc-checkident

Max number of tables (objects) in SQL Server editions (compact, express)

坚强是说给别人听的谎言 提交于 2019-12-12 02:58:46
问题 What are the maximum number of tables that you can have in: SQL CE4 SQL 2008 R2 Express Numbers here http://msdn.microsoft.com/en-us/library/ms143432.aspx I guess is for SQL Server 2008, but are they valid for Express and what about SQL CE4? The sum of the number of all objects in a database cannot exceed 2,147,483,647 BTW. Sorry for duplicating questions, but it seems to me Stackoverflow is providing answers more quickly. 回答1: No word about CE, but Express is normal SQL Server + database

Data inserts take longer for more iterations executed

元气小坏坏 提交于 2019-12-11 20:57:41
问题 I have an empty database which will contain a migrated form of an old legacy database. I read in all of the old data into DataTables which works fine. There is one master table which contains links for almost every table, so this is looped through. For every record that needs to go into the master table there are about 7 groups of tables, in each of which are only tables that rely on each other to work. so for example the Orders Table is in the same group as the OrderLine table as one relies

Sql Server Compact Limitations — design decision or work in progress?

。_饼干妹妹 提交于 2019-12-11 15:10:40
问题 I'm using Sql Server Compact for automated integration tests of our web application, which runs the latest version of Sql Server (large? uncondensed?). The idea was to use a more lightweight database to mimic our own, which would be easy to create and destroy for tests. I'm aware of the limitations that CE has in comparison to Sql Server, and am willing to work around these by either trying to avoid the features that aren't supported in CE or working around the tests for the areas of our app

Entity Data Model wizard in Visual Studio 2010 SP1 lacks support for EntitySQLServerCompact 4.0 in non ASP.Net projects

ⅰ亾dé卋堺 提交于 2019-12-11 14:15:47
问题 I finally found some resources and a solution. I will share it here. 回答1: It is documented here that this indeed is a feature and not a bug. In this excellent series of blogs you can find anything you always wanted to know, but never dared to ask about SQLServerCompact 4.0 The author of these blogs has made a wonderful Add-In for Visual Studio 2010 that adds Entity Data Model wizard functionality to create a model from a SQLServerCompact 4.0 database for any type of project. 来源: https:/

Very poor performance for batch insert with SQL Server CE 4.0 and Entity Framework 4.2

痞子三分冷 提交于 2019-12-09 16:37:38
问题 I'm inserting a lot of data into SQL Server CE 4.0 using Entity Framework 4.2 (code-first), and the performance is abysmal when compared to direct SQL insertion. The model is very simple: public class DocMember { public DocMember() { this.Items = new List<DocItem>(); } public int Id { get; set; } public string Name { get; set; } public string MemberType { get; set; } public string AssemblyName { get; set; } public virtual IList<DocItem> Items { get; set; } } public class DocItem { public int

How to use dynamic connection string for SQL Server CE?

自古美人都是妖i 提交于 2019-12-08 20:18:29
问题 I used SQL Server CE 4.0 in my windows app and use Entity Framework to create a model of it. It works fine but my problems is that it doesn't have a constructor to change the connection string, and by default it reads the connection string from the app.config file. using (var Context = new MyEntitiesModel(//has no constructor)) { ... } I create a dynamic connection string and using (var Context = new MyEntitiesModel()) { Context.Database.Connection.ConnectionString = entityConnection