Contribute to Docs Contribute to Docs

SQLite

Please remember that if you're going to use our provided packages for ASP.NET Core Identity you will also need need to include the SQLite package for Identity. For more information, please refer to article about using Identity for Piranha.

Installation

To use SQLite you need to add the NuGet package for running Piranha with Entity Framework Core and SQLite.

PM> install-package Piranha.Data.EF.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)
{
    ...

    // Service setup
    services.AddPiranha(options =>
    {
        options.UseEF<SQLiteDb>(db =>
            db.UseSqlite("Filename=./mydatabase.db"));
    });

    ...
}

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