Rask.Data
0.20.1-alpha.0.217
See the version list below for details.
dotnet add package Rask.Data --version 0.20.1-alpha.0.217
NuGet\Install-Package Rask.Data -Version 0.20.1-alpha.0.217
<PackageReference Include="Rask.Data" Version="0.20.1-alpha.0.217" />
<PackageVersion Include="Rask.Data" Version="0.20.1-alpha.0.217" />
<PackageReference Include="Rask.Data" />
paket add Rask.Data --version 0.20.1-alpha.0.217
#r "nuget: Rask.Data, 0.20.1-alpha.0.217"
#:package Rask.Data@0.20.1-alpha.0.217
#addin nuget:?package=Rask.Data&version=0.20.1-alpha.0.217&prerelease
#tool nuget:?package=Rask.Data&version=0.20.1-alpha.0.217&prerelease
Rask.Data
A tiny, provider-agnostic data layer for Entity Framework Core apps — the DDD building blocks the Rask tutorial builds its CRUD slices on, packaged for reuse.
Entity<TId>— a base entity withId, audit stamps (CreatedAt/UpdatedAt), and a domain-events buffer.- Opt-in markers — implement
ISoftDeletable(addsDeletedAt) orIVersioned(adds aVersionconcurrency token) on your entity to turn on the behavior. - Three
ISaveChangesInterceptors — auditing timestamps, transparent soft delete (aRemovebecomes aDeletedAtstamp behind a global query filter), and after-commit domain-event publication through Rask.Cqrs. BulkInsertAsync— the bulk insert EF Core leaves out (ExecuteUpdate/ExecuteDeleteexist; inserts are out of its scope). Batched, with the change tracker cleared as it goes so memory stays flat.
Use
public sealed class Product : Entity<Guid>, ISoftDeletable, IVersioned
{
public string Name { get; private set; } = "";
public DateTime? DeletedAt { get; private set; }
public int Version { get; private set; }
public static Product Create(string name) => new() { Id = Guid.NewGuid(), Name = name };
}
// Program.cs
builder.Services.AddRaskCqrs();
builder.Services.AddRaskData();
builder.Services.AddDbContextFactory<AppDbContext>((sp, o) => o
.UseSqlite("Data Source=app.db")
.AddInterceptors(sp.GetServices<ISaveChangesInterceptor>()));
// AppDbContext.OnModelCreating
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly);
modelBuilder.ApplyRaskConventions();
}
db.Remove(product) now soft-deletes; deleted rows drop out of queries (use IgnoreQueryFilters() to
restore); a save against a stale Version throws DbUpdateConcurrencyException; and any
INotification raised on the entity is published after the change commits.
To load many rows at once — seeding, an import, a migration — await db.BulkInsertAsync(products) (or
db.Products.BulkInsertAsync(...)) saves them in batches, clearing the change tracker between each so memory
stays flat. The interceptors above still run for every row. Each batch commits on its own so a long import
does not hold SQLite's only write lock end to end; o.SingleTransaction = true makes it all-or-nothing.
For the fastest load, o.SkipChangeTracking = true writes the rows with one prepared INSERT and no entity
entries at all. It is opt-in because it runs no ISaveChangesInterceptor — the writer stamps the audit
columns itself, but entities carrying domain events are rejected rather than silently losing them, and
anything it cannot map faithfully throws and names the reason.
Non-overlapping ranges
A booking, a lease, a price valid for a period: two rows must not cover the same point. SQLite has no
EXCLUDE constraint and a UNIQUE index only stops identical rows, so declare the rule on the model
instead:
modelBuilder.Entity<Booking>()
.HasNonOverlappingRange(x => x.StartsAt, x => x.EndsAt, partitionBy: x => x.RoomId);
Ranges are half-open ([lo, hi)), so 100-200 and 200-300 are neighbours rather than a conflict. With
Rask.SQLite.EntityFrameworkCore's UseRaskSqlite(...), migrations emit the triggers that enforce it and a
violating save throws RangeOverlapException. Enforcement lives in the database, so raw SQL is bound by it
too.
Part of the Rask framework. MIT licensed.
| 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 (>= 10.0.11)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.11)
- Rask.Cqrs (>= 0.20.1-alpha.0.217)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Rask.Data:
| Package | Downloads |
|---|---|
|
Rask.SQLite.EntityFrameworkCore
The Entity Framework Core integration for Rask.SQLite: `UseRaskSqlite(...)`, a drop-in replacement for `UseSqlite` that also registers a `ConnectionOpened` interceptor applying the production pragma set (WAL, `synchronous=NORMAL`, `foreign_keys=ON`, a `busy_timeout`, `mmap_size`, `journal_size_limit`) to every connection the context opens. Split out from Rask.SQLite so apps that only need the raw `Microsoft.Data.Sqlite` path (or run on mobile/AOT) don't pull in Entity Framework Core. |
|
|
Rask.Outbox
A transactional outbox for Rask.Data entities: domain events marked `IOutboxEvent` are written to an `OutboxMessage` table in the **same transaction** as the change that raised them (so an event is never lost and never fires for a rolled-back change), then a background `OutboxProcessor` polls the table and publishes them through Rask.Cqrs — at-least-once, crash-safe delivery, all on the app's own database (no broker, no Redis). A source generator registers each event type for reflection-free lookup. Server-side; pairs with Rask.Data. |
|
|
Rask
The one reference a Rask application needs, server or browser. On net10.0 it brings the ASP.NET host plus every battery — database, mediator, background jobs, transactional email, cache, outbox, operator dashboard, durable logs, Web Push, and SQLite snapshots and continuous backup — with RaskApp.Create(args) as the entry point. On net10.0-browser it brings the WebAssembly host, the source-generated mediator, the query cache and remote dispatch. Everything referenced is wired and on; app.Configure(c => c.Jobs.Off()) is how an app does without one. Reference Rask.Server for a lean host with no database. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.20.1-alpha.0.228 | 38 | 9/4/2026 |
| 0.20.1-alpha.0.227 | 38 | 9/4/2026 |
| 0.20.1-alpha.0.226 | 38 | 9/4/2026 |
| 0.20.1-alpha.0.225 | 44 | 9/4/2026 |
| 0.20.1-alpha.0.224 | 49 | 9/4/2026 |
| 0.20.1-alpha.0.223 | 42 | 9/4/2026 |
| 0.20.1-alpha.0.221 | 43 | 9/4/2026 |
| 0.20.1-alpha.0.220 | 45 | 9/4/2026 |
| 0.20.1-alpha.0.217 | 37 | 9/4/2026 |
| 0.20.1-alpha.0.216 | 43 | 9/4/2026 |
| 0.20.1-alpha.0.215 | 46 | 9/3/2026 |
| 0.20.1-alpha.0.213 | 41 | 9/3/2026 |
| 0.20.1-alpha.0.212 | 48 | 9/3/2026 |
| 0.20.1-alpha.0.211 | 49 | 9/3/2026 |
| 0.20.1-alpha.0.210 | 53 | 9/3/2026 |
| 0.20.1-alpha.0.209 | 44 | 9/2/2026 |
| 0.20.1-alpha.0.208 | 50 | 9/2/2026 |
| 0.20.1-alpha.0.207 | 54 | 9/2/2026 |
| 0.20.1-alpha.0.206 | 52 | 9/2/2026 |
| 0.20.0 | 128 | 8/6/2026 |