Which of the following classes belongs to the family of data source controls in the ASP.NET
framework, which enables a declarative data-binding model against a range of underlying data
stores?
A.
XmlDataSource
B.
SqlDataSource
C.
ObjectDataSource
D.
LinqDataSource
Explanation:
XmlDataSource belongs to the family of data source controls in the ASP.NET framework, which
enables a declarative data-binding model against a range of underlying data stores. The
XmlDataSource class is used to provide an XML data source to data-bound controls. It can be used by
data-bound controls to exhibit both hierarchical and tabular data. It is normally used to exhibit
hierarchical XML data in read-only states. Since the XmlDataSource class is inherited from the
HierarchicalDataSourceControl class, it works with hierarchical data. It also implements the
IDataSource interface and works with tabular or list-style data.
Answer B is incorrect. The SqlDataSource class is used to represent a SQL database to data-bound
controls. It can be used with a data-bound control to get data from a relational database as well as
to edit, display, and sort data on a Web page with least or no code. The SqlDataSource class can
support any SQL relational database that can be connected using the ADO.NET provider, such as the
SqlClient, OleDb, Odbc, or OracleClient providers.Answer D is incorrect. The LinqDataSource class is used to allow the use of LINQ in ASP.NET Web
pages by using the markup text to fetch and modify the data from a data object. It uses LINQ to SQL
to automatically generate the data commands. The data object can be either an in-memory data
collection or an object that displays data from a database. A user can fetch or alter the data without
writing SQL commands for each operation.
Answer C is incorrect. The ObjectDataSource class is used to represent a business object. The
business object gives data to data-bound controls in multi-tier Web applications. The
ObjectDataSource class allows users to use an ASP.NET data source control while retaining their
three-tier application architecture. The ObjectDataSource class makes use of reflection to construct
instances of business objects and to call methods on them to insert, update, retrieve, and delete
data. The ObjectDataSource class constructs and destroys an instance of the class for each method
call. However, it does not contain the object in memory for the lifetime of the Web request.