Getting to Know the Binding Source Component

The BindingSource component solves a number of tricky problems that surfaced with the approach of directly binding data sources to controls in .NET 1 .X. It provides a layer of indirection between a data source and bound controls that makes a number of things easier. Additionally, it surfaces important control points and access to the underlying data source in a way that saves you from having to delve into the data-binding mechanisms of a form the way you had to in the past. A binding source also gives you a single API to program against from the form's perspective, and lets a lot of your form code remain decoupled from the specific data source type. This prevents you from having to adapt your programmatic coding patterns to each different type of data that your application works with, whether they are data sets, data readers, custom business objects, arrays, or other types of data. The BindingSource component also exposes a rich set of events that you can tap into to respond to changes in the underlying data coming from other controls or code in your application. I'll be stepping through the use of all of these features throughout this chapter.


0 0

Post a comment