Tutorial

4.8 Run it

Start the application and place an order:

dotnet run --urls http://localhost:5080
curl -X POST http://localhost:5080/orders -H 'Content-Type: application/json' \
  -d '{"customerId":"ada","paymentToken":"tok_visa","lines":[{"sku":"MUG","quantity":2},{"sku":"TEE","quantity":1}]}'

The stock and the order are in the shop schema:

docker exec shopfront-postgres psql -U postgres -d shopfront \
  -c 'select "Sku", "Stock" from shop."Products" order by "Sku"' \
  -c 'select "CustomerId", "Total", "TransactionId" from shop."Orders"'
 Sku | Stock
-----+-------
 CAP |     0
 MUG |     8
 TEE |     2
(3 rows)
 
 CustomerId | Total | TransactionId
------------+-------+---------------
 ada        | 49.00 | tx_d8a78340
(1 row)

Stop the application and start it again. The stock is still eight mugs and two T-shirts, where before every restart refilled the shelves.

SDK Reference

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


Next: 4.9 Test against a real database