dataContracts.md
April 19, 2016 ยท View on GitHub
Data contracts
The data contracts library provides a framework for providing contracts with REST resources on the server. The consumer uses configuration options to specify the expected format for the contract and then uses the resourceBuilder to build the contract into a fully functional data service.
Resource builder
The resource builder is used to build data services from contract definitions.
Contract library
A base class to provide tools for mocking functions on the data contract library.
Data contract
The base configuration options for specifying a data contract.
Data service
The basic data service type
Singleton data service
A data service for getting and updating a single entity.
Data service view
A data service type representing a view of a parent resource. Functions as a normal data service unless a specific parent is selected, at which point the view is treated as a singleton.
Parent data service
A data service that my also have child data services defined under it.
Parent singleton data service
A parent data service for getting and updating a single entity.
Parent data service view
A parent data service that is a view of another parent.
Which resource type should I use?
Due to the variety of use cases, it can be difficult to determine which resource type is best suited to the situation. In these cases, use the following decision tree as a guide to assist in the decision.
- Is the resource a singleton? (Only one instance of that object exists on the server)
- Y
- Does the resource have children?
- Y
- N
- N
- Is the resource a child of another resource?
- Y
- Does the relationship have a 1-to-1 relationship with the parent?
- Y
- Does the resource have children?
- Y
- Is the parent resource a singleton?
- Y
- N
- N
- Is the parent resource a singleton?
- Y
- N
- Use dataServiceView
- N
- N
- Does the resource have children?
- Y
- N
- Use dataService