Getting Started with Transactional Entity Framework
This guide illustrates a more complex web service. This web service forms portfolios of stocks. Stock's prices constantly change and corresponding portfolio's performances must be updated also. The transactions must be parallelized as much as possible. The complete code can be found in the SDK.
The following image depicts the result:
- Add the
SymbolID property to the Stock entity. The SymbolID property is used to reference a stock by a portfolio position.
- Add the
Portfolio and Position entities:
- Add the following HTTP handler. The HTTP handler reads the latest committed state in parallel to any ongoing transactions.
- Add the following code to the
tef_portfolios function:
- The following code writes performance metrics to the output. Add it to the
tef_portfolios function:
- The following code writes portfolios to the output. Add it to the
tef_portfolios function:
- The following code writes stocks to the output. Add it to the
tef_portfolios function:
- The
tef_helloworld function simulates stock changes, modify it with the following code:
- Compile (F7) and run the project (F5). It starts the
tentity_svr.exe .
- In the browser, navigate to
http://127.0.0.1:42580/index.html . The following image depicts the output:
|