SQLite

Last Updated: 2018-12-22

SQLite is an awsome lightweight, portable database that is perfect for testing and development. As the database doesn't have the same support for foreign keys, index and other features that help ensure high data integrity we don't recommend it for production environments.

Installation

To use SQLite, make sure you add the NuGet package for running Entity Framework Core with SQLite.

Microsoft.EntityFrameworkCore.Sqlite

Registering The DbContext

After you've made sure you have the package reference you need you simply specify that you want to use SQLite and the connection information you want for your database in your Startup.cs.

public void ConfigureServices(IServiceCollection services)
{
...

services.AddPiranhaEF(options =>
options.UseSqlite("Filename=./mydatabase.db");

...
}

That's it! You're now using SQLite with Piranha.