A common application design practice is to separate the presentation layer from business logic and encapsulate the business logic in business objects. These business objects form a layer between the presentation layer and the data tier, resulting in a multi-tier application architecture. The ObjectDataSource component supports the multi-tier architecture by providing a way for you to bind the Data Report Items to a middle-tier business object without extensive code. The ObjectDataSource component represents the middle-tier object (business object or any other class) and provides data retrieval capabilities.
Any of the following data sources can be assigned to the DataSource property of the ObjectDataSource component:
Any component that implements IDataAdapter, including SqlDataAdapter and OleDbDataAdapter
System.Type which represents the type of the business object
If the DataSource reference contains more than one table, you must set the DataMember property to a string that specifies the table to bind to.
For example, if the DataSource is a DataSet or DataViewManager that contains three tables named Customers, Orders, and OrderDetails, you need to specify the table to bind to.
If the name of the DataMember (i.e. the table to bind to) is not specified, the first Table of the DataSet will be bound to the DataSource.
If the DataSource references a strongly typed array of objects (business objects) these objects must contain public properties.
If the DataSource is a business object, the DataMember property specifies the name of the method which should be invoked to retrieve the data.
If the DataMember property is not specified, the constructor of the type will be invoked.
If the constructor or the method contains arguments they can be specified through the Parameters collection of the ObjectDataSource component.
You can also bind to an ArrayList. A feature of the ArrayList is that it can contain objects of multiple types. The ObjectDataSource component binds to such a list despite the types of items in it. The only requirement is that they provide public properties with the same names as they are used in the expressions.
Already instantiated data objects do not have to be wrapped in a data source component. Instantiated data objects can be set directly to data items' DataSource properties.
*.NET Framework 4.0 and above
*.NET Core 2.0 and above
*.NET Standard 2.0 and above