You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The iOS and Android versions now uses SQLitePCL.raw as a nuget dependency, so your app will use the latest version of SQLite instead of the buggy one provided by the OS !
3
+
Add this package to your netstandard project:
4
4
5
-
See https://github.com/ericsink/SQLitePCL.raw/ for more information on how to use SQLitePCL.raw
5
+
```
6
+
TODO
7
+
```
8
+
9
+
And call this function in your executable projects (.net, ios, android, uwp, mac, ...):
6
10
7
-
Since SQLitePCL.raw 0.9 you have to add a new nuget package in your platform project:
11
+
```
12
+
SQLitePCL.Batteries_V2.Init()
13
+
```
14
+
15
+
16
+
See https://github.com/ericsink/SQLitePCL.raw/ for more information on how to use SQLitePCL.raw
8
17
9
-
SQLitePCL.plugin.sqlite3.ios_unified for ios
18
+
If you search a simple key value store based on sqlite, alternative to Akavache, check https://github.com/softlion/KeyValueLite
Usage: `ExecuteSimpleQuery<string>("select 'drop table ' || name || ';' from sqlite_master where type = 'table'")`
42
49
43
-
# Fork
44
-
45
-
This is a fork of oysteinkrog fork which is a fork of the original sqlite-net library (https://github.com/praeclarum/sqlite-net),
46
-
which aims to improve the code quality by using modern technologies such as PCL (portable class library).
47
-
48
-
This is a fork of the original sqlite-net library (https://github.com/praeclarum/sqlite-net), which aims to improve the code quality by using modern technologies such as PCL (portable class library).
49
-
50
-
The project will avoid the use of #if-based conditional code and use platform-specific code injection instead.
51
-
52
-
I welcome pull requests, but keep in mind that this library is in heavy use and all changes must be:
As part of the cleanup there are now some API changes.
63
-
For the most part I hope these are self-explanatory, but here is a non-exhaustive list of changes.
64
-
65
-
## SQLiteConnection
66
-
You now have to pass in an implementation of ISQlitePlatform in the SQLiteConnectionWithLock and SQLiteConnection constructors.
67
-
The correct platform implementation is automatically added to the project.
68
-
69
-
At the moment these platforms are supported:
70
-
- Win32 (bundles sqlite binaries for windows, works on both x86 and x64 automatically) (very well tested)
71
-
- XamarinIOS and XamarinIOS.Unified
72
-
- XamarinAndroid
73
-
- WindowsPhone8 (contributed by Nick Cipollina, thanks!)
74
-
- WinRT (Windows 8 and Windows Phone 8.1+) (contributed by Nick Cipollina and Micah Lewis, thanks!)
75
-
- Generic (net4 project without any sqlite3 binaries, requires sqlite installed in the OS) (contributed by James Ottaway)
76
-
77
-
Note:
78
-
To use the WP8.1/WinRT platform you must install the "SQLite for Windows Phone"/"SQLite for Windows" VSIX extension.
79
-
Then, in the project, add a reference to the extension (in the Extensions section of the Add Reference dialog)
80
-
If you have problems with signed apps take a look here: https://github.com/oysteinkrog/SQLite.Net-PCL/issues/25
81
-
82
-
## SQliteAsyncConnection
83
-
The SQLiteAsyncConnection class now takes a Func<SQLiteConnectionWithLock> in the constructor instead of a path.
84
-
This is done because the async classes are now just meant to be wrappers around the normal sqlite connection.
85
-
86
-
To use SQLiteAsyncConnection just create an instance of a SQLiteConnectionWithLock and pass in that through a func, e.g.:
87
-
new SQLiteAsyncConnection(()=>_sqliteConnectionWithLock);
88
-
89
-
Please be aware that the Task.Run pattern used in SQLiteAsyncConnection can be considered an anti-pattern (libraries should not provide async methods unless they are truly async).
90
-
This class is maintained for backwards compatability and for use-cases where async-isolation is handy.
91
-
92
-
## DateTime serialization
93
-
94
-
DateTime serialization is changed, in order to be consistent.
95
-
When using the storeDateTimeAsTicks option, the DateTime is now serialized as Utc, and the returned DateTime is also in Utc.
96
-
You can get the local time by using dateTime.ToLocalTime()
97
-
98
-
# SQLite.Net
50
+
# Original Fork
99
51
100
-
SQLite.Net is an open source, minimal library to allow .NET and Mono applications to store data in [http://www.sqlite.org SQLite 3 databases]. It is written in C# and is meant to be simply compiled in with your projects. It was first designed to work with [MonoTouch](http://xamarin.com) on the iPhone, but has grown up to work on all the platforms (Mono for Android, .NET, Silverlight, WP7, WinRT, Azure, etc.).
52
+
https://github.com/praeclarum/sqlite-net
101
53
102
-
SQLite.Net was designed as a quick and convenient database layer. Its design follows from these *goals*:
103
-
104
-
* Very easy to integrate with existing projects and with MonoTouch projects.
105
-
106
-
* Thin wrapper over SQLite and should be fast and efficient. (The library should not be the performance bottleneck of your queries.)
107
-
108
-
* Very simple methods for executing CRUD operations and queries safely (using parameters) and for retrieving the results of those query in a strongly typed fashion.
109
-
110
-
* Works with your data model without forcing you to change your classes. (Contains a small reflection-driven ORM layer.)
111
-
112
-
* 0 dependencies aside from a [compiled form of the sqlite2 library](http://www.sqlite.org/download.html).
113
-
114
-
*Non-goals* include:
115
-
116
-
* Not an ADO.NET implementation. This is not a full SQLite driver. If you need that, use [Mono.Data.SQLite](http://www.mono-project.com/SQLite) or [csharp-sqlite](http://code.google.com/p/csharp-sqlite/).
117
-
118
-
## License
119
-
This projected is licensed under the terms of the MIT license.
120
-
See LICENSE.TXT
121
-
122
-
## Meta
123
-
124
-
This is an open source project that welcomes contributions/suggestions/bug reports from those who use it. If you have any ideas on how to improve the library, please [post an issue here on github](https://github.com/praeclarum/SQLite.Net/issues). Please check out the [How to Contribute](https://github.com/praeclarum/SQLite.Net/wiki/How-to-Contribute).
125
-
126
-
127
-
# Example Time!
54
+
# Examples
128
55
129
56
Please consult the source code (see unit tests) for more examples.
130
57
@@ -203,54 +130,4 @@ You can perform low-level updates of the database using the `Execute` method.
203
130
204
131
## Asynchronous API
205
132
206
-
The asynchronous library uses the Task Parallel Library (TPL). As such, normal use of `Task` objects, and the `async` and `await` keywords
207
-
will work for you.
208
-
209
-
Once you have defined your entity, you can automatically generate tables by calling `CreateTableAsync`:
210
-
211
-
var conn = new SQLiteAsyncConnection(()=>sqliteConnection, "foofoo");
You can insert rows in the database using `Insert`. If the table contains an auto-incremented primary key, then the value for that key will be available to you after the insert:
218
-
219
-
Stock stock = new Stock()
220
-
{
221
-
Symbol = "AAPL"
222
-
};
223
-
224
-
var conn = new SQLiteAsyncConnection(()=>sqliteConnection, "foofoo");
The asynchronous API has been removed, as it was only wrapping synchronous methods in Task.Run(), which has nasty side effects as multiple Tasks are queued. Use your own Task.Run to achieve the same effect.
0 commit comments