Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

Nothing aligns their numbers. Auditing reached preview.2 a release after the other
three, for a fix of its own (IgnoreEntity<T>(), below); Settings and MultiLingual then
moved to preview.3 for fixes this sample's composition turned up, while Media and
Auditing stayed on preview.2. Four independently versioned libraries are four release
cadences, which is the other half of what "no shared kernel" means.
moved to preview.3 for fixes this sample's composition turned up, and Auditing followed
for its own side of them, while Media stayed on preview.2. Four independently versioned
libraries are four release cadences, which is the other half of what "no shared kernel"
means.
────────────────────────────────────────────────────────────────────────── -->
<ItemGroup Label="DotNetBoost — Settings">
<PackageVersion Include="DotNetBoost.Settings.Core" Version="1.0.0-preview.3" />
Expand Down Expand Up @@ -46,16 +47,16 @@
<ItemGroup Label="DotNetBoost — Auditing">
<!-- Who changed what, when, and from what to what. The engine plus the attributes; nothing
here is referenced by the other three, and nothing here references them. -->
<PackageVersion Include="DotNetBoost.Auditing.Core" Version="1.0.0-preview.2" />
<PackageVersion Include="DotNetBoost.Auditing.Core" Version="1.0.0-preview.3" />
<!-- The SaveChangesInterceptor that reads the change tracker, the EF Core store, and the two
tables. It asks for the same EF Core versions pinned below — 8.0.30 and 10.0.11 — so
adding it moved nothing in the persistence block. -->
<PackageVersion Include="DotNetBoost.Auditing.EntityFrameworkCore" Version="1.0.0-preview.2" />
<PackageVersion Include="DotNetBoost.Auditing.EntityFrameworkCore" Version="1.0.0-preview.3" />
<!-- The /api/audit endpoints, and the HttpContext-backed actor accessor that records who made
each change. Not here: DotNetBoost.Auditing.Dapper and .MongoDb, which are the other two
stores the library ships — this application keeps the trail in the PostgreSQL it already
has, in the DbContext it already has, which is what buys the transaction guarantee. -->
<PackageVersion Include="DotNetBoost.Auditing.API" Version="1.0.0-preview.2" />
<PackageVersion Include="DotNetBoost.Auditing.API" Version="1.0.0-preview.3" />
</ItemGroup>

<!-- ──────────────────────────────────────────────────────────────────────────
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,11 @@ pairing the two.
`Created` entry in a second, nested `SaveChanges`. Up to MultiLingual `1.0.0-preview.2` that nested
save also restarted MultiLingual's interceptor mid-save, dropping the outer save's pending work and
committing its transaction from the inside. `1.0.0-preview.3` fixed that: a nested save now joins
the outer one, and only the outermost writes, commits or rolls back. The nested save itself is still
Auditing's, though, so rather than depend on it the catalogue's entities keep their HiLo keys:
the outer one, and only the outermost writes, commits or rolls back. Auditing `1.0.0-preview.3`
fixed its own side the same way, so with either library registered first, the entity, its
translations and its `Created` entry commit or roll back together. The catalogue's entities keep
their HiLo keys anyway, because a creation in one save is simpler than a creation in two, and
dropping them would need a data migration:

```csharp
category.Property(c => c.Id).UseHiLo("CategoryIds");
Expand Down
11 changes: 6 additions & 5 deletions src/DotNetBoostSample.Infrastructure/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,12 @@ public static IServiceCollection AddInfrastructure(
// is that attribute applied from outside. Translated text is out of the trail anyway.
//
// 2. Keys. For a database-generated key, the interceptor writes a Created entry in a
// second, nested SaveChanges. Since MultiLingual 1.0.0-preview.3 a nested save joins
// MultiLingual's outer one rather than restarting it, so that is no longer a problem on
// MultiLingual's side — but the nested save is still Auditing's, and Category and
// Product keep HiLo keys (see their configurations) so the id exists when the entity is
// added and every entry goes into the caller's own save.
// second, nested SaveChanges. Since MultiLingual 1.0.0-preview.3 and Auditing
// 1.0.0-preview.3 both libraries count nested saves, so that save is safe beside
// MultiLingual's interceptor in either registration order. Category and Product keep
// HiLo keys anyway (see their configurations): the id exists when the entity is added,
// so a creation's entry goes into the caller's own save, with no second save and no
// transaction opened to cover one.
//
// 3. Settings. The library stores a group one row per property. IgnoreEntity<Setting>()
// keeps those rows out, and SettingGroupAuditParticipant records the save as one entry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ public void Configure(EntityTypeBuilder<Category> category)

// The id comes from a HiLo sequence rather than an identity column: EF reserves a block of
// ids from "CategoryIds" and hands one out when the entity is ADDED, before anything is saved.
// That is what keeps a creation's audit entry in the same SaveChanges as the row:
// DotNetBoost.Auditing defers the entry for a key the INSERT has yet to generate, to a
// second save nested inside the first. MultiLingual (since 1.0.0-preview.3) lets a nested
// save join its own, so the reason is now Auditing's nested save alone — see
// That is what keeps a creation's audit entry in the same SaveChanges as the row: for a key
// the INSERT has yet to generate, DotNetBoost.Auditing defers the entry to a second save
// nested inside the first, and opens a transaction to cover both. Since 1.0.0-preview.3 of
// both libraries that nested save is safe beside MultiLingual's interceptor, so HiLo is no
// longer what keeps the two apart; it keeps a creation to one save — see
// Infrastructure/DependencyInjection.cs. DatabaseInitialiser creates the sequence on a
// database made before it existed.
//
Expand Down
Loading