Skip to content

Commit

Permalink
fixup! WIP: Document Microsoft.Data.Sqlite
Browse files Browse the repository at this point in the history
Address feedback
  • Loading branch information
bricelam committed Dec 10, 2019
1 parent a3904bf commit e0fc206
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions msdata-sqlite/custom-sqlite.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
title: Custom SQLite Versions - Microsoft.Data.Sqlite
author: bricelam
ms.date: 11/25/2019
ms.date: 12/10/2019
---
# Custom SQLite Versions

Microsoft.Data.Sqlite is built on top of SQLitePCL.raw. You can use custom versions of the native SQLite library be using a bundle or by configuring a SQLitePCL.raw provider.
Microsoft.Data.Sqlite is built on top of SQLitePCLRaw. You can use custom versions of the native SQLite library by using a bundle or by configuring a SQLitePCLRaw provider.

## Bundles

SQLitePCL.raw provides bundle packages that make it easy to bring in the right dependencies across different platforms.
SQLitePCLRaw provides bundle packages that make it easy to bring in the right dependencies across different platforms.

The main Microsoft.Data.Sqlite package brings in SQLitePCLRaw.bundle_e_sqlite3 by default.

To use a different bundle, install the `Microsoft.Data.Sqlite.Core` package along with the bundle package you want to use. Bundles are automatically initialized by Microsoft.Data.Sqlite.
To use a different bundle, install the `Microsoft.Data.Sqlite.Core` package instead along with the bundle package you want to use. Bundles are automatically initialized by Microsoft.Data.Sqlite.

Bundle | Description
--- | ---
Expand Down Expand Up @@ -41,14 +41,14 @@ Install-Package SQLitePCLRaw.bundle_e_sqlcipher

---

## SQLitePCL.raw Providers
## SQLitePCLRaw Providers

You can use your own build of SQLite by leveraging the `SQLitePCLRaw.provider.dynamic_cdecl` package. In this case, you're responsible for deploying the native library with your app.
You can use your own build of SQLite by leveraging the `SQLitePCLRaw.provider.dynamic_cdecl` package. In this case, you're responsible for deploying the native library with your app. Note, the details of deploying native libraries with your app vary considerably depending on which .NET platform and runtime you're using.

First, you'll need to implement IGetFunctionPointer. The implementation is fairly trivial on .NET Core.

[!code-csharp[](../samples/msdata-sqlite/SystemLibrarySample/Program.cs?name=snippet_NativeLibraryAdapter)]

Next, configure the SQLitePCL.raw provider. Ensure this is done before Microsoft.Data.Sqlite is used in your app.
Next, configure the SQLitePCLRaw provider. Ensure this is done before Microsoft.Data.Sqlite is used in your app. Also, avoid using a SQLitePCLRaw bundle package which might override your provider.

[!code-csharp[](../samples/msdata-sqlite/SystemLibrarySample/Program.cs?name=snippet_SetProvider)]
4 changes: 2 additions & 2 deletions msdata-sqlite/interop.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ms.date: 11/25/2019
---
# Interoperability

Microsoft.Data.Sqlite uses SQLitePCL.raw to interact with the native SQLite library. SQLitePCL.raw provides a thin .NET API over the native SQLite API. SqliteConnection and SqliteDataReader provide access to the underlying SQLitePCL.raw objects letting you call these APIs directly.
Microsoft.Data.Sqlite uses SQLitePCLRaw to interact with the native SQLite library. SQLitePCLRaw provides a thin .NET API over the native SQLite API. SqliteConnection and SqliteDataReader provide access to the underlying SQLitePCLRaw objects letting you call these APIs directly.

Here is an example of calling sqlite3_trace to write executed SQL statements to the console.

Expand All @@ -15,4 +15,4 @@ And this example shows calling sqlite3_stmt_status to see how many SQLite virtua

[!code-csharp[](../samples/msdata-sqlite/InteropSample/Program.cs?name=snippet_StatementStatus)]

The SQLitePCL.raw objects even expose a pointer to the native objects letting you P/Invoke additional native SQLite APIs.
The SQLitePCLRaw objects even expose a pointer to the native objects letting you P/Invoke additional native SQLite APIs.
4 changes: 2 additions & 2 deletions msdata-sqlite/xamarin.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ms.date: 11/27/2019
---
# Xamarin

Microsoft.Data.Sqlite targets .NET Standard 2.0 and is supported on Xamarin. The following table shows which platforms the default SQLitePCL.raw bundle provides native SQLite binaries for. See [Custom SQLite Versions](custom-sqlite.md) for details on using a different bundle or providing your own native SQLite binaries.
Microsoft.Data.Sqlite targets .NET Standard 2.0 and is supported on Xamarin. The following table shows which platforms the default SQLitePCLRaw bundle provides native SQLite binaries for. See [Custom SQLite Versions](custom-sqlite.md) for details on using a different bundle or providing your own native SQLite binaries.

Platform | SQLite binaries
--- | ---
Expand All @@ -25,7 +25,7 @@ Platform | SQLite binaries

## iOS limitations

Microsoft.Data.Sqlite tries to automatically initialize SQLitePCL.raw bundles. Unfortunately, because of limitations in the ahead-of-time (AOT) compilation for Xamarin.iOS, the attempt fails and you get the following error.
Microsoft.Data.Sqlite tries to automatically initialize SQLitePCLRaw bundles. Unfortunately, because of limitations in the ahead-of-time (AOT) compilation for Xamarin.iOS, the attempt fails and you get the following error.

> You need to call SQLitePCL.raw.SetProvider(). If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init().
Expand Down

0 comments on commit e0fc206

Please sign in to comment.