system.data.sqlite

SQLite with Entity Framework

試著忘記壹切 提交于 2019-12-02 15:51:59
I'm having a problem with primary keys in Entity Framework when using SQLite. SQLite wants an explicit NULL in the VALUES list on an autoincrementing primary key column. I haven't actually looked at the generated SQL in the EF Context, but I believe it's going with the usual SQL Server convention of providing no value for the autoincrementing column. According to the site for the ADO.NET SQLite provider, EF is fully supported but I'm finding no help there. Is there a way to force EF to explicitly insert a NULL for the primary key value? Well I've finally made this work :D. You need to set the

is it possible to use sqlite manifest typing features in nhibernate?

坚强是说给别人听的谎言 提交于 2019-12-02 13:48:24
问题 this was posted on hibernate.org forums and nhusers list without much luck, so I thought I would try here. Put simply, suppose I have a class: class A { public virtual object SomeValue { get; set; } } the type of SomeValue is basically in the set of .NET IConvertible types (primitives like bool, byte, char, int16, double, float etc.), plus byte[] and string. I am trying to create a nhibernate mapping for A to reflect this - so that I can basically set SomeValue to an arbitrary object (of one

Compile System.Data.Sqlite With AES256

醉酒当歌 提交于 2019-12-02 10:53:42
I'm knee deep in compilation for sqlite, system.data.sqlite, and xerial's JDBC trying to get an encrypted sqlite file working through all three. From my understanding, system.data.sqlite uses RC4 encryption, and SQLCipher/Rijndael/wxSqlite can use AES256. Using this library , one can easily compile Windows binaries for AES256 encryption. This library offers Xerial's JDBC by incorporating wxsqlite3's improvements , which it looks like is actually based on the above (Rijndael's) library. Because the above two libraries are close to one-and-the-same, and use the same encryption, they have been

Using the GLOB function in LINQ to Entities

江枫思渺然 提交于 2019-12-02 03:27:33
问题 I need SQLite's glob function in a (C#) method which has to return Expression<Func<RandomEntity, bool>> -- and I need glob because only then the index is used (already checked using EXPLAIN QUERY PLAN [..] ). So I added the following function mapping to <edmx:StorageModels><Schema> (SSDL): <Function Name="glob" Aggregate="false" BuiltIn="true" NiladicFunction="false" IsComposable="true" ReturnType="bit"> <Parameter Name="pattern" Mode="In" Type="nvarchar"/> <Parameter Name="target" Mode="In"

Using the GLOB function in LINQ to Entities

[亡魂溺海] 提交于 2019-12-02 01:14:38
I need SQLite's glob function in a (C#) method which has to return Expression<Func<RandomEntity, bool>> -- and I need glob because only then the index is used (already checked using EXPLAIN QUERY PLAN [..] ). So I added the following function mapping to <edmx:StorageModels><Schema> (SSDL): <Function Name="glob" Aggregate="false" BuiltIn="true" NiladicFunction="false" IsComposable="true" ReturnType="bit"> <Parameter Name="pattern" Mode="In" Type="nvarchar"/> <Parameter Name="target" Mode="In" Type="nvarchar"/> </Function> and a C# stub method: public static class SQLiteFunctions { [DbFunction(

Do I have to Dispose the SQLiteCommand objects?

放肆的年华 提交于 2019-12-01 17:46:57
How do I treat the SQLiteCommand object, do I have to call Dispose() after ExecuteScalar , ExecuteNonQuery and ExecuteReader or not? The documentation example on SQLiteCommand doesn't dispose it whilst in the SQLiteTransaction the example disposes the SQLiteCommand object. I always close the data reader object though. My application accesses the db from many threads. Mostly I am interested in not leaking connections or disturbing SQLite. I am aware of using and IDisposable usage It's best-practise to dispose everything that implements IDisposable as soon as you're finished with it because it

What does “Data Source cannot be empty. Use :memory: to open an in-memory database” mean?

和自甴很熟 提交于 2019-12-01 15:16:03
I recently converted my SQL Server database into SQLite DB. But when I try to open my SQLite using .Open() it throws me this error: Data Source cannot be empty. Use :memory: to open an in-memory database Edit: added connection string: ConnectionString = @"Data Source=D:\XXX.db;Version=3"; connection = new SQLiteConnection(connectionString); connection.Open(); Why do I get this? I converted the same SQL Server database to SQL CE and mySQL and I didn't get these errors. There's a space after your data source: Data Source= D:\XXX.db . Also, in your copy/paste, there's no closing quote to the

What does “Data Source cannot be empty. Use :memory: to open an in-memory database” mean?

ⅰ亾dé卋堺 提交于 2019-12-01 14:12:27
问题 I recently converted my SQL Server database into SQLite DB. But when I try to open my SQLite using .Open() it throws me this error: Data Source cannot be empty. Use :memory: to open an in-memory database Edit: added connection string: ConnectionString = @"Data Source=D:\XXX.db;Version=3"; connection = new SQLiteConnection(connectionString); connection.Open(); Why do I get this? I converted the same SQL Server database to SQL CE and mySQL and I didn't get these errors. 回答1: There's a space

Unicode strings into a SQLite database

人走茶凉 提交于 2019-12-01 09:34:27
I would like some help with my Visual Studio C# code with inserting unicode strings into a SQLite database. Below is my test code to write a test string to the database: string testStr = "á Á ñ ç é á"; SQLiteConnection mydataConnection = new SQLiteConnection(); // setup new sql connection obj try { //// SQLite DB mydataConnection.ConnectionString = "Data Source=C:\\Users\\John\\Desktop\\location.db; Version=3; UseUTF16Encoding=True;Synchronous=Normal;New=False"; // set up the connection string mydataConnection.Open(); // open the connection to the db SQLiteCommand myCmd = new SQLiteCommand();

Unicode strings into a SQLite database

强颜欢笑 提交于 2019-12-01 06:33:38
问题 I would like some help with my Visual Studio C# code with inserting unicode strings into a SQLite database. Below is my test code to write a test string to the database: string testStr = "á Á ñ ç é á"; SQLiteConnection mydataConnection = new SQLiteConnection(); // setup new sql connection obj try { //// SQLite DB mydataConnection.ConnectionString = "Data Source=C:\\Users\\John\\Desktop\\location.db; Version=3; UseUTF16Encoding=True;Synchronous=Normal;New=False"; // set up the connection