StreamStore.Sql.Sqlite 0.4.0

dotnet add package StreamStore.Sql.Sqlite --version 0.4.0                
NuGet\Install-Package StreamStore.Sql.Sqlite -Version 0.4.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StreamStore.Sql.Sqlite" Version="0.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StreamStore.Sql.Sqlite --version 0.4.0                
#r "nuget: StreamStore.Sql.Sqlite, 0.4.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install StreamStore.Sql.Sqlite as a Cake Addin
#addin nuget:?package=StreamStore.Sql.Sqlite&version=0.4.0

// Install StreamStore.Sql.Sqlite as a Cake Tool
#tool nuget:?package=StreamStore.Sql.Sqlite&version=0.4.0                

StreamStore.Sql.Sqlite

NuGet version (StreamStore.Sql.Sqlite)

SQLite backend database for StreamStore asynchronous event sourcing library.

Installation

To install the package, you can use the following command from the command line:

  dotnet add package StreamStore

  dotnet add package StreamStore.Sql.Sqlite

or from Nuget Package Manager Console:


  Install-Package StreamStore

  Install-Package StreamStore.Sql.Sqlite

Usage

Storage

By default the library provisioning tables automatically, however you must create database or provide connection string to existing database.

If you want to create table manually, you can use the following script:

  CREATE TABLE IF NOT EXISTS main.Events (
      Id TEXT NOT NULL,
      StreamId TEXT NOT NULL,
      Timestamp datetime2 NOT NULL, 
      Revision INTEGER NOT NULL,
      Data BLOB NOT NULL,
      PRIMARY KEY (Id, StreamId)
  );

  CREATE INDEX IF NOT EXISTS main.ix_streams_stream_id ON Events(StreamId);
  CREATE INDEX IF NOT EXISTS main.ix_streams_stream_revision ON Events(Revision);
  CREATE UNIQUE INDEX IF NOT EXISTS main.ix_streams_stream_id_revision ON Events(StreamId, Revision);

Configuration

You can define configuration of the library in appsettings.json file:

{
  "ConnectionStrings": {
    "StreamStore": "Data Source=streamstore.db" // Required for single tenant configuration
  },
  "StreamStore": { // Optional
    "Sqlite": {
      "SchemaName": "main", // Optional
      "TableName": "Events", // Optional
      "ProvisionSchema": true, // Optional
    }
  }
}

Register in DI container

services.ConfigureStreamStore(x =>...

  // Register single database implementation
  x.WithSingleDatabase(c => ...
      c.UseSqliteDatabase(x =>
          c => c.ConfigureDatabase(x =>                        // Configure database options.
            x.WithConnectionString("your-connection-string")   // Required. Connection string.
            x.WithSchema("your-schema-name");                  // Optional. Schema name, default is "main".
            x.WithTableName("your-table-name");                // Optional. Table name, default is "Events".
      )
  )

  // Or enable multitenancy
  x.WithMultitenancy(c => ...
      c.UseSqliteDatabase(x => 
          x.WithConnectionStringProvider<Provider>()          // Required. Register your 
                                                              // ISqlTenantConnectionStringProvider implementation.
          c => c.ConfigureDatabase(x =>...)                   // Optional. Configure database options will be used as 
                                                              // template for tenant database configuration, optional.
      )
  )
); 

Use in application code

How to use StreamStore in your application code you can find on StreamStore page.

Example

You can find an example of usage in the StreamStore.Sql.Example project.

License

MIT License

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.4.0 74 11/17/2024
0.3.0 72 11/15/2024
0.2.1 82 11/11/2024
0.2.0 77 11/8/2024
0.1.0 94 10/20/2024