Ferrous Music Store API

Ferrous Music Store API

API reference generated by dotnet fe doc — 20 public type(s).

Typestate Protocol Graph

stateDiagram-v2
    [*] --> DraftCart
    DraftCart --> DraftCart : ApplyPromo()
    DraftCart --> ReservedOrder : ReserveInventory()
    DraftCart --> CancelledOrder : Abandon()
    ReservedOrder --> PaidOrder : CapturePayment()
    ReservedOrder --> CancelledOrder : ReleaseInventory()
    PaidOrder --> [*]
    CancelledOrder --> [*]

MusicStore.Api.Data

TypeKindSummary
MusicStoreDbContextclassEF Core SQLite database context with automatic Ferrous refined-type and [Newtype] conventions.

MusicStore.Api.Services

TypeKindSummary
CatalogSummaryrecordSnapshot of store catalog and order metrics gathered via structured concurrency.
InventoryCacheclassData-owning inventory cache backed by Mutex<T>. Eliminates raw lock blocks — it is impossible to read or mutate the dictionary without holding the guard.
StoreServiceclassException-free, instrumented store service combining Result<T, TError>, linear [Typestate] checkout, ScopeGuard rollback, and structured TaskScope.

MusicStore.Domain

TypeKindSummary
AlbumclassAn album in the music store catalog with strongly-typed IDs and refined title.
AlbumId [Newtype]structStrongly-typed album identifier (prevents swapping with ArtistId or OrderId).
ArtistId [Newtype]structStrongly-typed artist identifier.
CancelledOrder [Typestate]classTerminal state representing a cancelled or abandoned checkout.
CheckoutRequestrecordRequest payload to place an order.
CustomerEmail [Newtype]structValidated customer email address.
DraftCart [Typestate]classInitial state of the linear checkout protocol. Cannot be paid or shipped until inventory is reserved via ReserveInventory (enforced at compile time by FE0300–FE0303).
GenreId [Newtype]structStrongly-typed genre identifier.
OrderclassA customer order with strongly-typed IDs, non-zero quantity, and validated email.
OrderId [Newtype]structStrongly-typed order identifier.
OrderStatusenumClassic mutable order status enum — replaced by linear [Typestate] in Chapter 4.
PaidOrder [Typestate]classTerminal state representing a paid, ready-to-fulfill order.
PromoCode [Newtype]structOptional promotional discount code.
ReservedOrder [Typestate]classIntermediate state holding reserved inventory. Must transition to either PaidOrder or CancelledOrder before leaving scope (otherwise FE0301 flags a resource leak).
StoreError [DiscriminatedUnion]structExhaustive, zero-boxing discriminated union of all domain errors in the Music Store. Replaces KeyNotFoundException, ArgumentException, and InvalidOperationException with compile-time exhaustiveness checking.

(global)

TypeKindSummary
ProgramclassMarker partial class for integration testing.