Tutorial

4.1 One context, one schema

Trax's own tables belong to Trax's data context. An application's data goes in a context of its own, derived from DomainDataContext<TSelf>, which holds to one rule: one context, one Postgres schema. Code that uses the data depends on an interface beside the context, never on the context itself.

By the end of the chapter the new files are:

Shopfront/
└── Data/
    ├── IShopfrontDbContext.cs
    ├── ShopfrontDbContext.cs
    └── Models/
        ├── Product.cs
        ├── Order.cs
        └── OrderItem.cs

SDK Reference

DomainDataContext | EnsureSchemaCreatedAsync | Add a domain data context | IFailureClassifier | Architecture guards


Next: 4.2 Packages