Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

README.md

Uno Platform based SQLitePCLRaw provider for WebAssembly

This repository is the home for the SQLitePCLRaw provider for WebAssembly, providing SQLite support for EntityFramework Core, SQLite-net, or any SQLitePCLRaw-based library.

The package is using Uno.sqlite-wasm, a WebAssembly built binary for the SQLite database engine.

You can see it in action here: http://sqliteefcore-wasm.platform.uno/

The Nuget package is available here: Uno.SQLitePCLRaw.provider.wasm

Usage

SQLitePCL.Batteries.Init();

That's it !

Architecture

This package is providing the SQLite implementation used by many database abstractions, such as SQLite-net or EntityFramework Core.

The SQLite implementation is provided under the covers as a statically linkable bitcode file, and requires the use of the Uno.Wasm.Boostrap.

EFCoreSample

This sample demonstates the use of the SQLitePCLRaw provider for WebAssembly, along with EntityFramework Core and Roslyn using Uno Platform.

The application is built with all the EntityFramework Core binaries, allowing for custom code to be compiled and run locally in the browser, to test EF Core database scenarios dynamically.

Special considerations for Windows build servers

If you're building a WebAssembly application with the Uno.SQLitePCLRaw.provider.wasm package on a Windows CI Server, you may get into an error like this one:

Error : System.InvalidOperationException: WSL is required for this build but could not be found (Searched for [C:\windows\sysnative\bash.exe]).

If your CI server does not have WSL enabled (e.g. Azure Devops Hosted Agents), you'll need to disable the static linking of the SQLite native library. It will generate an invalid package, but the build will finish properly.

Note that this restriction is temporary until msbuild supports solution filters (most likely VS 16.7+), where removing some projects from a solution will be lots easier.

Here's how to the static linking of the SQLite native library. In your XX.Wasm.csproj file, add the following:

<PropertyGroup>
	<CanUseAOT Condition="$([MSBuild]::IsOsPlatform('Linux')) or ( $([MSBuild]::IsOsPlatform('Windows')) and '$(BUILD_REPOSITORY_PROVIDER)'=='' )">true</CanUseAOT>
</PropertyGroup>

<ItemGroup Condition="'$(CanUseAOT)'==''">
	<PackageReference Include="Uno.sqlite-wasm" Version="1.1.0-dev.16828" IncludeAssets="none" />
</ItemGroup>