QuickPersistr 0.0.2
dotnet add package QuickPersistr --version 0.0.2
NuGet\Install-Package QuickPersistr -Version 0.0.2
<PackageReference Include="QuickPersistr" Version="0.0.2" />
<PackageVersion Include="QuickPersistr" Version="0.0.2" />
<PackageReference Include="QuickPersistr" />
paket add QuickPersistr --version 0.0.2
#r "nuget: QuickPersistr, 0.0.2"
#:package QuickPersistr@0.0.2
#addin nuget:?package=QuickPersistr&version=0.0.2
#tool nuget:?package=QuickPersistr&version=0.0.2
QuickPersistr
Property-based persistence testing for .NET.
QuickPersistr generates entities and sequences of create, read, update, and delete operations, then checks the persisted result through fresh sessions. Failed runs are shrunk to a small reproducible case and include a seed for replay.
This package contains the engine and persistence contracts. EF Core users normally install one of the provider packages instead. This brings this package in transitively.
Choose a package
| Package | Use it for |
|---|---|
QuickPersistr.EntityFrameworkCore.Sqlite |
Isolated in-memory SQLite tests |
QuickPersistr.EntityFrameworkCore.PostgreSql |
Isolated databases on a real PostgreSQL server |
QuickPersistr.EntityFrameworkCore |
EF Core with externally managed database setup |
QuickPersistr |
Implementing an adapter for another persistence technology |
To implement an adapter, provide IPersistenceScope<TReader> and IPersistenceReader<TReader>. A scope must be able to commit changes and discard its current session without discarding committed data. Composite identities use the array overloads, and optimistic-concurrency specifications require OpenConcurrentSession().
public interface IPersistenceReader<TReader>
{
TResult Query<TResult>(Func<TReader, TResult> query);
}
The complete contracts are in IPersistenceScope.cs and IPersistenceReader.cs.
Aggregate roots and dependents
Specifications registered with .Entities(...) are independently persisted roots. A child specification supplied through .From(...) in a HasOne or HasMany contract is instead exercised through its parent, so required foreign keys are valid. QuickPersistr runs its full configured contract: generated and unique identities, property reads and updates, domain updates, optimistic concurrency, nested relationships, rejected operations, deletion, and post-delete expectations. Generated child updates leave relationship-owned foreign keys untouched, and rejected creates attach through the parent before commit. Register the child separately only when it can also be validly persisted without its parent.
Replaying a failure
Every failed run reports its seed. Pass that seed to Run to reproduce the same generated scenario:
persister.Run(seed);
See the project README for the full DSL, examples, and provider guidance.
QuickPersistr is an early preview targeting .NET 8. Until version 1.0, its public API may change between releases.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- QuickCheckr (>= 0.2.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on QuickPersistr:
| Package | Downloads |
|---|---|
|
QuickPersistr.EntityFrameworkCore
Provider-neutral Entity Framework Core persistence scope for QuickPersistr. |
GitHub repositories
This package is not used by any popular GitHub repositories.