ObjectBinder

BLToolkit.NET

Business Logic Toolkit for .NET www.bltoolkit.net
 

The ObjectBinder component has been designed to simplify binding controls on a form to objects for FW 1.x. Since Microsoft has released FW 2.0 we can use the BindingSource component to bind controls to objects. However the ObjectBinder still can be useful as it supports a few features which are not available for the BindingSource. Those features are:

  • Support for field binding along with property binding.

  • Support for inner class field and property binding such as Order.Address.Line1.

  • Support for the ObjectView feature which is available by assigning an object view type to the ObjectBinder.ObjectViewType property. An object view is an object that implements the IObjectView interface. This interface includes only one property - object Object { get; set; }. An object view can implement additional properties based on the assosiated object. The ObjectBinder will combine all of these properties with main object properties and create a single PropertyDescriptor collection. This feature can be used to separate UI presentation logic from business model objects and to keep them clean. ObjectView should be a stateless, lightweight object as its single instance can be assigned to many assosiated objects.

  • The ObjectBinder is optimized for high performance applications such real-time multithreaded message processing and distribution banking systems. So it does not use reflection to access objects. The standard way (which is used by the BindingSource) is to call the TypeDescriptor.GetProperties method to get a PropertyDescriptor collection. This method creates property descriptors that access object properties by reflection. The ObjectBinder has its own mechanism to avoid unnessasy reflection and boxing/unboxing operations.

The dev version of BLToolkit contains a demo project (Demo\WinForms) showing the use of the ObjectBinder.

 
© 2010 www.bltoolkit.net
[email protected]