PrepAway - Latest Free Exam Questions & Answers

Which of the following classes is used to represent a business object that gives data to data-bound controls i

Which of the following classes is used to represent a business object that gives data to data-bound
controls in multi-tier Web applications?

PrepAway - Latest Free Exam Questions & Answers

A.
LinqDataSource

B.
ObjectDataSource

C.
XmlDataSource

D.
SqlDataSource

Explanation:
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.
Answer C is incorrect. XmlDataSource represents an XML data source to the data-bound controls
such as GridView and TreeView controls. Data-bound controls can use XmlDataSource to display
both hierarchical data and tabular data. The XmlDataSource control extends the
HierarchicalDataSourceControl class and works with hierarchical data. It also implements the
IDataSource interface; hence, it works with tabular data, or list style data.
Answer D is incorrect. The SqlDataSource represents a database connection that uses an ADO.NET
provider such as SqlClient, Odbc, etc. The SqlDataSource control enables a Web server control to
access data located in a relational database. The SqlDataSource control can be used with data bound
controls such as GridView, FormView, and DetailsView to display and modify data on a Web page. It
uses ADO.NET classes to interact with any database supported by ADO.NET, such as Microsoft SQL
Server and Oracle.


Leave a Reply