Yak: csharp after situation (Yak 02) — plain domain + DTOs + mappers

After/: plain Client/Order (no DbBase), ClientDto/OrderDto records
carrying the relations both ways, hand-written Mappers with a
reference-identity cache for the back-reference cycle, DbContext with
explicit Save(domain) via shadow entities (flipped dependency), and a
WebApp that consumes only DTOs. AfterTests cover the 7 required
behaviours; full solution builds with 0 warnings, 26/26 tests pass.
This commit is contained in:
2026-09-11 15:02:35 +01:00
parent 463245288a
commit c22a1e2ffa
10 changed files with 644 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
namespace After;
/// <summary>
/// An order as a plain domain object: no <see cref="DbBase"/> inheritance, no
/// knowledge of <see cref="DbContext"/>. Its data travels to the WebApp as an
/// <see cref="OrderDto"/>.
/// </summary>
public class Order
{
/// <summary>
/// Primary key as a plain value: <see cref="Guid.Empty"/> until a
/// <see cref="DbContext"/> explicitly saves this order (which copies a
/// generated id in).
/// </summary>
public Guid Id { get; set; }
/// <summary>Free-text description of what this order is for.</summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// The client that owns this order. Set automatically by
/// <see cref="ClientOrders"/> when the order is added to
/// <see cref="Client.Orders"/> (navigation fix-up).
/// </summary>
public Client? Client { get; set; }
}