What should you do?

You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database.
You use the ADO.NET LINQ to SQL model to retrieve data from the database. You use stored procedures to return multiple result sets.
You need to ensure that the result sets are returned as strongly typed values. What should you do?

You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database.
You use the ADO.NET LINQ to SQL model to retrieve data from the database. You use stored procedures to return multiple result sets.
You need to ensure that the result sets are returned as strongly typed values. What should you do?

A.
Apply the FunctionAttribute and ResultTypeAttribute to the stored procedure function.
Use the GetResult<TElement> method to obtain an enumerator of the correct type.

B.
Apply the FunctionAttribute and ParameterAttribute to the stored procedure function and directly
access the strongly typed object from the results collection.

C.
Apply the ResultTypeAttribute to the stored procedure function and directly access the strongly typed object from the results collection.

D.
Apply the ParameterAttribute to the stored procedure function.
Use the GetResult<TElement> method to obtain an enumerator of the correct type.

Explanation:
You must use the IMultipleResults.GetResult<TElement> Method pattern to obtain an enumerator of the correct type, based on your knowledge of the stored procedure.
FunctionAttribute Associates a method with a stored procedure or user-defined function in the database.

IMultipleResults.GetResult<TElement> Method
(http://msdn.microsoft.com/en-us/library/bb534218.aspx)



Leave a Reply 1

Your email address will not be published. Required fields are marked *