// EF Core 10 teaching excerpts for a separately configured disposable project.
// Not a standalone compilation unit; no publisher EF execution is claimed.
// 1. In OnModelCreating(ModelBuilder modelBuilder):
modelBuilder.Entity<Order>().Property(o => o.Version).IsConcurrencyToken();
// 2. In an async read method with a fresh, owned OrdersContext db:
var rows = await db.Orders.AsNoTracking().OrderBy(o => o.Id)
    .ToListAsync(cancellationToken);
// 3. In the reviewed migration Up(MigrationBuilder migrationBuilder):
migrationBuilder.RenameColumn(name: "CustomerName", table: "Orders", newName: "BuyerName");
migrationBuilder.AddColumn<string>(name: "Status", table: "Orders", nullable: false, defaultValue: "Pending");
migrationBuilder.AddColumn<int>(name: "Version", table: "Orders", nullable: false, defaultValue: 1);
// Pending is valid here only because all seed orders are unfulfilled.
// 4. In an async update method, after loading a tracked order:
order.Status = "Paid";
order.Version += 1;
try { await db.SaveChangesAsync(cancellationToken); }
catch (DbUpdateConcurrencyException)
{
    // Business policy for this exercise: reject the stale intent.
    // Preserve database data; propagate the conflict for the caller to reload.
    // Do not blindly replace OriginalValues with current values and retry.
    throw;
}
// Relevant imports in that project: Microsoft.EntityFrameworkCore,
// Microsoft.EntityFrameworkCore.Migrations. Order has Id, BuyerName, Status,
// Version; OrdersContext exposes DbSet<Order> Orders and configured provider.
