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
<PackageReference Include="StreamStore.Sql.Sqlite" Version="0.4.0" />
paket add StreamStore.Sql.Sqlite --version 0.4.0
#r "nuget: StreamStore.Sql.Sqlite, 0.4.0"
// 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
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
Product | Versions 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. |
-
.NETStandard 2.1
- Dapper (>= 2.1.35)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- StreamStore.Contracts (>= 0.8.0)
- System.Data.SQLite (>= 1.0.119)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.