SoftwareDriven.Persistence.EF.SQLite
3.1.0
dotnet add package SoftwareDriven.Persistence.EF.SQLite --version 3.1.0
NuGet\Install-Package SoftwareDriven.Persistence.EF.SQLite -Version 3.1.0
<PackageReference Include="SoftwareDriven.Persistence.EF.SQLite" Version="3.1.0" />
<PackageVersion Include="SoftwareDriven.Persistence.EF.SQLite" Version="3.1.0" />
<PackageReference Include="SoftwareDriven.Persistence.EF.SQLite" />
paket add SoftwareDriven.Persistence.EF.SQLite --version 3.1.0
#r "nuget: SoftwareDriven.Persistence.EF.SQLite, 3.1.0"
#:package SoftwareDriven.Persistence.EF.SQLite@3.1.0
#addin nuget:?package=SoftwareDriven.Persistence.EF.SQLite&version=3.1.0
#tool nuget:?package=SoftwareDriven.Persistence.EF.SQLite&version=3.1.0
SoftwareDriven.Persistence.EF.SQLite
Entity Framework Core / SQLite provider for SoftwareDriven.Persistence. Bundles the EF Core base provider. Targets net10.0.
Installation
dotnet add package SoftwareDriven.Persistence.EF.SQLite
Setup
// Register EF manager and providers
services.AddEntityFramework<SQLiteManager>();
services.AddEFProviderScoped<MyModel>((modelBuilder, entityBuilder) =>
{
entityBuilder.HasMany(x => x.Children).WithOne().OnDelete(DeleteBehavior.Cascade);
});
// Connect
var manager = serviceProvider.GetRequiredService<EFManager>() as SQLiteManager;
await manager!.Connect("data/mydb.db");
With DbContext options
await manager.Connect("data/mydb.db", options =>
{
options.EnableSensitiveDataLogging();
});
Provider Registration
// Scoped (recommended for web apps)
services.AddEFProviderScoped<MyModel>(map, registerBaseInterface: true);
// Singleton
services.AddEFProviderSingleton<MyModel>(map, registerBaseInterface: true);
// Without mapping
services.AddEFProviderScoped<SimpleModel>();
The registerBaseInterface parameter controls whether IBasicPersistenceProvider<T> is registered in DI (default: true). Set to false when resolving the concrete EFRepositoryProvider<T> directly.
Entity Mapping
services.AddEFProviderScoped<Order>((modelBuilder, entityBuilder) =>
{
// Complex types
modelBuilder.Entity<Address>().ComplexProperty(x => x.Location);
// Relationships
entityBuilder.HasMany(x => x.Items).WithOne().OnDelete(DeleteBehavior.Cascade);
});
Usage
var provider = serviceProvider.GetRequiredService<EFRepositoryProvider<MyModel>>();
await provider.CreateOrUpdate(new MyModel { Title = "Hello" });
var results = await provider.FindByExpression(x => x.Title == "Hello");
Maintenance
var statistics = await manager.GetStatistics();
// TotalBytes: database file plus write-ahead log
// ReclaimableBytes: freelist_count * page_size, i.e. the pages deleting released for reuse only
var result = await manager.Compact();
// BytesBefore / BytesAfter tell what the compaction achieved
Compact() runs VACUUM followed by PRAGMA wal_checkpoint(TRUNCATE). The checkpoint is not optional: in WAL
mode VACUUM writes the compacted pages into the write-ahead log and the database file keeps its size until a
checkpoint runs.
Note:
VACUUMrewrites the whole database and therefore needs the double amount of storage while it runs.- It needs exclusive access; other connections with running statements let it fail.
Microsoft.Data.Sqlitehas no asynchronous path, soCompact()runs synchronously on the calling thread despite itsTaskbased signature. Move it off the UI thread yourself if the database is large.
Features
SupportsTotalCount: trueSupportsPagingState: false (offset-based pagination)DefaultIdSource:GuidSourceSupportsMaintenance: true (VACUUMplus WAL checkpoint)- Implements
IBasicPersistenceProvider<T>(not the extendedIPersistenceProvider<T>)
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.EntityFrameworkCore.Sqlite (>= 10.0.11)
- SoftwareDriven.Persistence (>= 3.1.0)
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 |
|---|---|---|
| 3.1.0 | 38 | 8/25/2026 |
| 3.0.4 | 147 | 4/2/2026 |
| 3.0.3 | 140 | 2/11/2026 |
| 3.0.0 | 144 | 2/1/2026 |
| 2.12.0 | 146 | 1/8/2026 |
| 2.9.0 | 297 | 11/30/2024 |
| 2.8.0 | 258 | 7/7/2024 |
| 2.7.12 | 253 | 6/10/2024 |
| 2.7.11 | 231 | 6/4/2024 |
| 2.7.10 | 205 | 6/3/2024 |
| 2.7.9 | 224 | 6/3/2024 |
| 2.7.8 | 252 | 5/29/2024 |
| 2.7.7 | 255 | 5/24/2024 |
| 2.7.6 | 256 | 5/16/2024 |
| 2.7.5 | 232 | 5/16/2024 |
| 2.7.4 | 261 | 5/7/2024 |
| 2.7.2 | 268 | 5/7/2024 |
| 2.7.1 | 270 | 4/22/2024 |
| 2.7.0 | 308 | 11/27/2023 |