DataBinding Custom Tool

Rating:        Based on 1 rating
Reviewed:  1 review
Downloads: 555
Released: Oct 4, 2007
Updated: Feb 6, 2009 by dcazzulino
Dev status: Beta Help Icon

Recommended Download

Application DataBindingTool-bin-2.0.zip
application, 372K, uploaded Jul 29, 2008 - 293 downloads

Other Available Downloads

Source Code DataBindingTool-src-2.0.zip
source code, 86K, uploaded Jul 29, 2008 - 262 downloads

Release Notes

This custom tool will generate a partial class file implementing INotifyPropertyChange as well as a strongly-typed event for each property declared in the file it's applied to.

This is very useful when creating models or entities that are used in data-binding scenarios, and where an associated presenter needs to perform certain logic when a given property changes.
Communicating through these strong-typed events prevents tight coupling between the presenter and the UI, which now communicate exclusively through the model/data context.
A must-have for anyone doing "Binding Oriented Programming" ;)

The code generator solves the problem of having the presenter attach to the generic INotifyPropertyChanged.PropertyChanged event and checking the property by name, which must be kept in sync with the class definition and doesn't participate in refactorings.

It will also solve the initialization sequence and validation (post deserialization and afterwards) problem by implementing ISupportInitialize, ISupportInitializeNotification and IChangeTracking, which allows it to track changes automatically on its members and nested values. The public interface of your object remains uncluttered by implementing most of these privately. The data context class can simply call EnsureInitialized at the beginning of each method call to make sure that the class has been properly initialized, and that if it's dirty, it's re-validated.

A DoValidate method is added to the main class to implement the actual property validation (where you could use the Standalone Validation Block for example), as well as RaiseXXChanged method calls on each property setter, and a DoInitialize to perform custom initialization logic that should happen after validation.

Finally, the generated code doesn't depend on anything other than System.ComponentModel, so WPF is not even required to use the codegen for other data-binding scenarios (WinForms should work fine).

Installation: run the MSI, or compile the included solution.
Usage: assign the value DataBinding to any code file in VS. A corresponding file ending in ".DataBinding.cs" (or .vb) will be generated automatically everytime the main file changes.

This release supports both VB and C# (both 2.0 and 3.5), VS2005 and VS2008, as well as full unit tests for the generated code. It also supports inheritance between models, which changes the generated code to hook into the virtuals provided by the generator for the base class.

Reviews for this release

     
The test project in c#source does not compile. I compiling code in VS 2008. Thest test project references the DataBindingTool project. The test project has a total of 28 errors. email me at sun_water_snow@hotmail.com with any solutions
by stevensrf on Nov 17, 2010 at 1:38 AM