sql-server-ce

SQL Server Compact 4.0 vs. SQLite

时光怂恿深爱的人放手 提交于 2019-11-29 00:53:05
I'm interested in choosing an embedded DB engine for my WPF app. I would like information on how SQLite and latest SQL CE 4.0 compare. And if I should choose one over the other. Points of interest would be ORM support with EF4's CTP & NHibernate 3. Thanks in advance! ErikEJ See this answer: Database functionality with WPF app: SQLite, SQL CE, other? - SQL Compact 4 has full support for Entity Framework, Linq to SQL - Includes all neccesary file for private deployment - has good tools support in Visual Studio 2010 and 2012 - has a smooth migration path to SQL Server 来源: https://stackoverflow

Database functionality with WPF app: SQLite, SQL CE, other? [closed]

时光总嘲笑我的痴心妄想 提交于 2019-11-29 00:31:27
问题 I want to extend a WPF application with database functionality. Which database engine would you suggest and why? SQLite, SQL CE, other? 回答1: Depending on the applications use, I would recommend using SQL Lite because it doesn't require you to install any other software (SQL CE or Express, etc. usually would require a separate install). A list of the most important benefits for SQL Lite from the provider link at the bottom of this post: SQLite is a small C library that implements a self

EF 5 + SQL Server CE 4: How to specify custom location for database file?

本秂侑毒 提交于 2019-11-29 00:09:20
I am developing a client system that needs a small local database. I want to avoid installation of SQL Server Express and have decided to go with SQL Server 4. I use Entity Framework 5 for data access and have created my custom context. Everything works fine in development where I can use app.config to either set specific file location or dynamic Data Source=|DataDirectory|\MyDatabase.sdf . But on deploy I want the database to be located in the users documents folder: \My Documents\ApplicationName\MyDatabase.sdf How can I do that? All I need is actually to be able to set custom connection

AssertionFailure: “null identifier” - FluentNH + SQLServerCE

不问归期 提交于 2019-11-28 23:26:37
The code fails at session.Save(employee); with AssertionFailure "null identifier". What am I doing wrong? using FluentNHibernate.Cfg; using FluentNHibernate.Cfg.Db; using FluentNHibernate.Mapping; using NHibernate; using NHibernate.Cfg; using NHibernate.Tool.hbm2ddl; namespace FNHTest { public class Employee { public virtual int Id { get; private set; } public virtual string Name { get; set; } public virtual string Surname { get; set; } } public class EmployeeMap : ClassMap { public EmployeeMap() { Id(e => e.Id); Map(e => e.Name); Map(e => e.Surname); } } public class DB { private static

What is the best way to represent a timespan in SQL Server CE?

爷,独闯天下 提交于 2019-11-28 22:45:25
Specifically speaking I only need hours:minutes but say I have a .NET TimeSpan object, how should I store that in a SQL(CE) database? I'd recommend using a long to represent the number of ticks . That's what TimeSpan uses as it's internal representation. This lets you easily reconstitute your object with the Timespan.FromTicks() method, and output to the database using the Timespan.Ticks property . The smallest unit of time in .NET is the tick, which is equal to 100 nanoseconds Bubba Store as a varchar. Save to sql using TimeSpan.ToString() . Read from sql as: TimeSpanObj = TimeSpan.Parse

An overflow occurred while converting to datetime using EF4

假装没事ソ 提交于 2019-11-28 21:14:17
I have a windows application working with a SQL Compact 4.0 database, using EF 4.1 and code-first approach. I cannot save an object to the database since I'm getting an exception, with inner exception "An overflow occurred while converting to datetime" when trying to save the type Quotation: public class Quotation { public int ID { get; set; } public string Name { get; set; } public DateTime DateCreated { get; set; } public ContactPerson ContactPersonAssigned { get; set; } public string OurReference { get; set; } public string QuotationDataString { get; set; } } I read that this error can be

Generate SQL CE database from EF Code-First DbContext class

↘锁芯ラ 提交于 2019-11-28 19:19:54
问题 I've defined a set of classes in the style of Entity Framework Code-First conventions and annotated the class properties with System.ComponentModel.DataAnnotations attributes. Now I want to generate a SQL Server Compact Edition (SCSE) (4.0) database from this code. What code is needed to do this and what assemblies need to be imported? So far I've imported the C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Desktop{System.Data.SqlServerCe.dll,System.Data.SqlServerCe.Entity

Entity Framework 4 and SQL Compact 4: How to generate database?

倾然丶 夕夏残阳落幕 提交于 2019-11-28 16:06:41
I am developing an app with Entity Framework 4 and SQL Compact 4, using a Model First approach. I have created my EDM, and now I want to generate a SQL Compact 4.0 database to act as a data store for the model. I bring up the Generate Database Wizard and click the New Connection button to create a connection for the generated file. The Choose Data Source dialog appears, but SQL Compact 4.0 is not listed in the list of available data sources: I am running VS 2010 SP1 (beta) and I have installed the VS 2010 Tools for SQL Compact 4.0. I can create a SQL Compact 4.0 data connection from the Server

Blocking behaviour with Entity Framework Async methods and SQL Server Compact

三世轮回 提交于 2019-11-28 14:29:11
I have an MVVM app that calls a data service to get some data to bind. The data service accesses a SQL Server Compact (v4.0) database through Entity Framework 6. The data (currently) takes a few seconds to be loaded and when called synchronously this (not surprisingly) blocks the GUI thread. Most of this I had assumed to be IO bound so I added an equivalent Async method to execute the data load in an asynchronous fashion to allow the GUI to remain responsive. However when I make use of the EF Async methods, it doesn't appear to make any difference, the GUI thread still blocks, for roughly the

Why can't I insert a record into my SQL Compact 3.5 database?

大憨熊 提交于 2019-11-28 14:02:30
I just made a very simple test app using documentation from MSDN. All I want to do is insert a record into my table which is in a SQL Server Compact database in my VS 2010 app. But when I run it, it acts like it executes fine (no errors), but a record is never inserted into my SQL Compact 3.5 database when I go to view the table data from Server Explorer. My code is as follows: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlServerCe; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { SqlCeConnection conn