-
Notifications
You must be signed in to change notification settings - Fork 3
Getting data from request
Almost every request carries some data with it, that we can divide into two categories:
First category - publicly available data, that is known to all components, no matter where it comes from, such as common orderId created by main application when user want to check out his shopping cart, or collection of productIds delivered as part of a form. These data is well defined on a page and all components know how to extract this information from request.
Second category is private component data, that belongs to only one component and other parts of a system don't know about existing these informations. That can be for example products names in shopping cart when checking out shopping cart - only ProductsService knows this data, because it's the only one that is responsible for products names in a system (however productIds can be publicly known). To avoid name conflicts on a page - because other services can put the their private data with the same names - we can simple prefix each service's private data uniquely - for example with service name - which can be easily done using template views. In this way we can conclude that each service knows what data it put into request's data and therefore it also knows how to get it from the request.
Finally where to get data from - all sended data resides in static HttpContext, so when main application publishes request to services, each service has access to all needed data and it can get it out in a way it wants.
Example of form widget for adding cutomer, where some data is public and some data is private, using templates:
@model CustomerModel
@Html.EditPublic(p => p.CustomerId) //public data without service specific prefix - <input name="CustomerId" value="someId">
@Html.Edit(p => p.Name) //private data that will be rendered as <input name="CustomersService.Name" value="SomeName">
@Html.Edit(p => p.Surname) //private data that will be rendered as <input name="CustomersService.Surname" value="SomeSurname">
Example of action handling adding customer post request:
[HttPost]
[InternalAction]
public ActionResult AddCustomer([Bind(Prefix = CustomersConst.ServiceName)] CustomerModel model, Guid customerId)
{
//handling logic
return RequestHandled();
}
Of course data which is public on page is available to all components, so main application can also use it while handling request:
[HttPost]
public ActionResult AddCustomer(Guid customerId)
{
//Handle request
return RedirectToAction("CustomerSummary", new { id = customerId });
}
-
Welcome
1.1 Project overview
1.2 Features -
Introduction
2.1 UI composition example
2.2 Service separation
2.3 Service communication
2.4 UI composition goals
2.5 Clues how to start
2.6 Potencial problems -
Identifying widgets
3.1 Naming widgets
3.2 Widgets format
3.3 Amount of widgets
3.4 Widgets and service boundaries
3.5 Widgets and caching
3.6 Grid for widgets -
Delivering view models
4.1 Publishing request
4.2 Internal routing
4.3 Data in view models
4.4 Gathering view models -
Rendering view models
5.1 External routing
5.2 Including route values
5.3 Finiding physical view files
5.4 Template views - Getting data from request
- Sharing resources
- Service api
-
Transactions
9.1 One transaction
9.2 Multiple transactions
9.3 Transaction performance - Dependency injection
- Public api changes
- [Tables] (https://github.com/padzikm/CompositeUI/wiki/Tables)
12.1 Table order
12.2 Server-side rendering
12.3 Client-side rendering
12.4 Nested tables -
Cross-service validation
13.1 Server-side validation
13.2 Client-side validation -
CRUD
14.1 Service private data
14.2 Create
14.3 Update
14.4 Delete
14.5 Preview -
Caching
15.1 View models
15.2 Widgets
15.3 Pages - Optimizing network calls
- Scalling
- Client-side communication
- Deployment
- Starting new project