sqlite-net

ManyToOne constraint not working

牧云@^-^@ 提交于 2019-12-07 18:07:27
I have very simple relationship, my model looks like this: public class Project { [PrimaryKey, AutoIncrement] public int ID { get; set; } public string Name { get; set; } [ForeignKey(typeof(User))] public int ProjectManagerID { get; set; } [ManyToOne] public User ProjectManager { get; set; } } public class User { public string Login { get; set; } [OneToMany] public List<Project> Projects { get; set; } } The problem is that I can easly save project, with its reference to user without saving user, and I don't get any constraint violation exception. database.Insert(new Project { Name = "aaa",

Sqlite One to Many Relationship

痴心易碎 提交于 2019-12-07 05:46:27
问题 I'm currently making an app that needs to store and get data to and from a sqlite database. The two Nuget packages I'm currently using are Sqlite PCL and SQLite-Net Extensions . [Table("patient")] public class Patient { [PrimaryKey] public string ID { get; set;} public string FirstName { get; set; } public string LastName { get; set; } [OneToMany] public List<PatientVitals> PatientVitals { get; set; } } [Table("patientVitals")] public class PatientVitals { [PrimaryKey] public string VitalID

Windows Phone 8.1 Sqlite-net foreign key relationship

拥有回忆 提交于 2019-12-06 14:58:00
I have installed sqlite-net from NuGet package in my windows phone universal app. But it does not contain foreign key relationship attribute between tables. I searched the web and found that SQLITE-Net Extenstions can handle this by using attributes, But it can only be installed on Windows 8.1 app not on windows Phone 8.1. How can use this extension in windows phone 8.1 or is there any other solution for foreign key relationships in sqlite? Thanks! There exists a PCL version of this library. If you install via NuGet, you might see this error You can solve this by cloning the repository as

Unable to load DLL 'sqlite3' - for Windows Universal Mobile

*爱你&永不变心* 提交于 2019-12-06 08:53:06
问题 I used Visual Studio 2015 with SP2. I try created Windows Universal app with sqlite. I added SQLite for Unversal Windows Platforms and SQLite.Net-PCl. It is my simple code var conn = new SQLiteConnection( new SQLitePlatformWinRT(), Path.Combine(ApplicationData.Current.LocalFolder.Path, "Storage.sqlite")); It is working for desktop. But it is not work for mobile(in device and emulator). I get this exception System.DllNotFoundException: HResult=-2146233052 Message=Unable to load DLL 'sqlite3':

Sqlite One to Many Relationship

别说谁变了你拦得住时间么 提交于 2019-12-05 11:34:21
I'm currently making an app that needs to store and get data to and from a sqlite database. The two Nuget packages I'm currently using are Sqlite PCL and SQLite-Net Extensions . [Table("patient")] public class Patient { [PrimaryKey] public string ID { get; set;} public string FirstName { get; set; } public string LastName { get; set; } [OneToMany] public List<PatientVitals> PatientVitals { get; set; } } [Table("patientVitals")] public class PatientVitals { [PrimaryKey] public string VitalID {get;set;} public string Weight { get; set;} public string Height { get; set;} [ForeignKey(typeof

Using SQLite-NET with UWP

旧街凉风 提交于 2019-12-05 04:17:38
I downloaded the package from NuGet and still there's no SQLite.cs neither SQLiteAsync.cs added to the project, If SQLite-NET is still not supporting VS 2015 RTM, Any possible alternatives? Note that I tried SQLite.NET-PCL and still the same problem. SQLite.NET-PCL shouldn't add those two classes directly to your project files. Did you download the right SQLite.NET-PCL via NuGet? (there's a huge mess when you search for SQLite.NET on NuGet so it's easy to get confused and install the wrong one). Did you install the SQLite VSIX package for Universal App Platform development using Visual Studio

upgrading SQLite-net to SQLite.net - create SQLiteConnection

我是研究僧i 提交于 2019-12-04 05:55:47
I used to open my SQLiteConnection in my shared project as following: var conn = new SQLiteConnection("MyDb.db3"); The constructor has been changed to the following signature: public SQLiteConnection(ISQLitePlatform sqlitePlatform, string databasePath, bool storeDateTimeAsTicks = true, IBlobSerializer serializer = null, IDictionary<string, TableMapping> tableMappings = null, IDictionary<Type, string> extraTypeMappings = null, IContractResolver resolver = null); public SQLiteConnection(ISQLitePlatform sqlitePlatform, string databasePath, SQLiteOpenFlags openFlags, bool storeDateTimeAsTicks =

SQLite - create table if not exists

混江龙づ霸主 提交于 2019-12-04 04:53:49
问题 What is the create table statement in SQLite meant to return? I have observed create table if not exists returning both a 0 and 1 when the table does in fact exist. Is the return value a reliable indication of whether the table does exist or not? I would expect the statement to return a 0 if the table already exists and a 1 when it does not, similar to an insert statement. 回答1: Changes returns the number of affected rows . This values is meaningless for CREATE TABLE statements. There is no

Upgrading database on app update

爱⌒轻易说出口 提交于 2019-12-03 21:52:12
I am developing a Windows Store App that uses SQLite for Windows Runtime Extension and sqlite-net library to store data in a local SQLite database. This database is created in Windows.Storage.ApplicationData.Current.LocalFolder.Path path. Everything works like it should and I guess I will not have problems when submiting. Question 1 But what will happen when I change the app, submit again and the user updates it? Will database file be deleted? Will the user lost his data? Question 2 Will I be able to use the old database and upgrade it between app versions? I know how to do it when developing

SQLite - create table if not exists

折月煮酒 提交于 2019-12-02 01:01:00
What is the create table statement in SQLite meant to return? I have observed create table if not exists returning both a 0 and 1 when the table does in fact exist. Is the return value a reliable indication of whether the table does exist or not? I would expect the statement to return a 0 if the table already exists and a 1 when it does not, similar to an insert statement. Changes returns the number of affected rows . This values is meaningless for CREATE TABLE statements. There is no easy way to determine whether the CREATE TABLE IF NOT EXISTS statement did the creation or not. You should