Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

DELETE ME_a.k.a Business object controls (BOCs, "re-bind layer")

Note
titlereader requirements

We assume that you have understood the overview
re-motion components and have at least a passing
familiarity with ASP.NET (2.0).

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:

  • property is a date -> date picker
  • property is a 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 this. Depending on metadata and configuration, the re-bind layer can 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

How does re-bind know how to display domain objects and their properties? In order to do that, the BOC layer queries the domain object's (or your right shoe's) IBusinessObject interface (if your right shoe supports IBusinessObject, what it probably doesn't), which in turn looks up important information like size constraints and nullability in the properties' metadata. The BOC layer can not only display domain objects. Whatever supports IBusinessObject is eligible for rendering in a browser by re-bind. Good examples for this 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).