Prev | Current Page 399 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

Here is how DataSet is declared:
public class DataSet : MarshalByValueComponent, IListSource,
ISupportInitialize, ISerializable
The IListSource interface implemented by the DataSet provides a way to determine if
there are multiple DataTable child collections by checking the value of the Boolean
ContainsListCollection property. If the class implementing IListSource supports a bindable
list, we need to use the ITypedList interface to bind to it at runtime. The DataViewManager class
provides just such a bindable list for the DataTables that make up a DataSet. DataViewManager
has the following declaration:
public class DataViewManager : MarshalByValueComponent,
IBindingList, IList, ICollection, IEnumerable, ITypedList
The GetList method of the IListSource interface implemented by the DataSet class
returns an instance of the ITypedList interface implemented by the DataViewManager class
through casting to the appropriate interface. We use the ITypedList interface to dynamically
bind to the correct data source. Figure 7-4 provides a diagram of the process required to handle
an ITypedList data source such as a DataSet.
Figure 7-4. Resolving IListSource data sources
























294 CHAPTER 7 ?–  SE RVER CONTROL DATA B INDING
ITypedList gives us the ability to dynamically find properties exposed by a class.


Pages:
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411