rewrite comments in neutral, terse style

Doc comments, inline comments, and README no longer editorialize about
the code (ActiveRecord, leak, fake, Yak before/after). They now describe
behavior only. Test A_client_can_reach_its_DbContext__the_leak renamed
to A_client_can_reach_its_DbContext. No behavior changes; all 27 tests
pass.
This commit is contained in:
2026-09-15 17:26:15 +01:00
parent 0d19a1f171
commit d60ea160c4
9 changed files with 99 additions and 354 deletions
+4 -13
View File
@@ -1,15 +1,7 @@
using Before;
// ---------------------------------------------------------------------------
// Before.Console — a straight-line demo of the ActiveRecord-style pattern.
//
// The console app sets DbBase.Context (the shared singleton) once at startup,
// then creates client/order entities, saves them through the context, and
// queries back using the ActiveRecord entry points:
// • Client.FindByName(name) — no context argument: rides the
// DbBase.Context singleton
// • listing via DbBase.Context!.Tracked
// ---------------------------------------------------------------------------
// Before.Console — seeds clients and orders, saves them through the
// DbContext, and queries them via the Client finders and DbBase.Context.
var ctx = new DbContext();
DbBase.Context = ctx;
@@ -23,7 +15,7 @@ jane.Orders.Add(new Order { Description = "Website redesign" });
bob.Orders.Add(new Order { Description = "Monthly retainer" });
// Orders need to be attached too so they get IDs:
// Orders are attached separately so they get IDs:
ctx.Attach(jane.Orders[0]);
ctx.Attach(jane.Orders[1]);
ctx.Attach(bob.Orders[0]);
@@ -43,7 +35,6 @@ foreach (var client in DbBase.Context!.Tracked.OfType<Client>())
// ----- find by name -------------------------------------------------------
Console.WriteLine("\n=== Find by Name (null-returning) ===");
// No context argument: FindByName falls back to the DbBase.Context singleton.
var found = Client.FindByName("Jane Doe");
if (found is not null)
{
@@ -68,7 +59,7 @@ catch (ObjectNotFoundException ex)
Console.WriteLine($"Not found: {ex.Message}");
}
// Show the contrast with a non-existent name:
// ----- a name that matches nothing ----------------------------------------
Console.WriteLine("\n=== Miss: null-returning vs throwing ===");
var missNull = Client.FindByName("Nobody Here");
Console.WriteLine($"FindByName(\"Nobody Here\"): {(missNull == null ? "null" : missNull.Name)}");