...
re-bind
...
Note | ||
---|---|---|
| ||
We assume that you have understood the overview |
re-bind lets you assemble controls to forms
"Business object controls" give (bindable) domain objects faces and handles in a browser, but their use is not limited to domain objects. Business object controls can give faces and handles to anything that supports the interface IBusinessObject
, and this includes domain objects (which, by defintion, get promoted to bindable domain objects if they have this virtue). To illustrate the concept, let's focus on a domain object in particular and a simple example.
For a domain object of type Person, the browser displays a form with text entry fields or other controls for each property of the "person" instance. "First name" and "sure name" are obviously text entry fields. Other possible obvious relationships between properties and controls:
...
- the faces of your domain objects
re-bind is the face of your domain object and every object that implements the IBusinessObject
interface.
Key Features
- Data binding
- Generate your pages from your domain source code
Illustration
Each data type has its favorable control. Think of a domain object Person. A person has a name, birthday, height, etc. Repectively, the first and last name would be entered in a text box, the birthday in a date time picker, etc.
Data is loaded from the domain objects with re-store. The loaded data is displayed in the controls. Once you have changed the data and clicked on save, the data is commited to the database.
All this implementation details
- mapping from domain objects and their properties to user controls for display
- mapping from the controls' user input to the corresponding updates of properties
will be done by re-bind.
Default Mapping
- date -> date picker
- number -> text entry field with a check if the entered string can be parsed as a number
- property is a boolean -> check box
- property is an enumeration -> drop box
Things are not that easy, however, because re-motion's re-bind (binding) layer is more flexible than thisYou are not bound to this controls. Depending on metadata and your configuration, the re-bind layer can could display a Boolean
property as radio buttons, drop box or checkbox, for example. So the BOC layer's job is
- to map from domain objects and their properties to user controls for display
- to map from the controls' user input to the corresponding updates of properties
...
Implementation Details
re-bind queries the implementation of the IBusinessObject
interface of the object to be displayed. Depending on the class attributes and the markup configuration in your markup files (ascx and aspx), the content of the web page will be rendered.
So re-bind is not restricted to domain objects that will be persisted with re-store. Every object that implements the IBusinessObject
interface are eligible for rendering in a browser by re-bind. Good examples for this non domain objects are "search objects", i.e. sets of query parameters which support IBusinessObject
, but are never stored in the database (and thus don't qualify for being domain objects)which will never be stored in a database, but must be displayed.