最新的Microsoft TS: Accessing Data with Microsoft .NET Framework 4 - 70-516免費考試真題
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. You create the classes shown in the following exhibit:

You add the following code segment to the application. (Line numbers are included for reference only.)
01 public void QueryPlayers (List <League> leagues) {
02 ...
03 }
You create a LINQ query to retrieve a collection of Player objects.
You need to ensure that the collection includes all the players from each team and every league. Which
code segment should you insert at line 02?

You add the following code segment to the application. (Line numbers are included for reference only.)
01 public void QueryPlayers (List <League> leagues) {
02 ...
03 }
You create a LINQ query to retrieve a collection of Player objects.
You need to ensure that the collection includes all the players from each team and every league. Which
code segment should you insert at line 02?
正確答案: A
How do you define a WCF Data Service query to grab the first 10 records. Options are something like:
正確答案: B
說明:(僅 Fast2test 成員可見)
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server
2008 database.
You need to ensure that the application connects to the database server by using SQL Server
authentication.
Which connection string should you use?
2008 database.
You need to ensure that the application connects to the database server by using SQL Server
authentication.
Which connection string should you use?
正確答案: C
說明:(僅 Fast2test 成員可見)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database. You add the following store procedure
to the database.
CREATE PROCEDURE GetProducts AS BEGIN
SELECT ProductID, Name, Price, Cost FROM Product END
You create a SqlDataAdapter named adapter to execute the stored procedure. You need to fill a DataTable
instance with the first 10 rows of the result set.
What are two possible code segments that you can use to achieve the goal?
The application connects to a Microsoft SQL Server 2008 database. You add the following store procedure
to the database.
CREATE PROCEDURE GetProducts AS BEGIN
SELECT ProductID, Name, Price, Cost FROM Product END
You create a SqlDataAdapter named adapter to execute the stored procedure. You need to fill a DataTable
instance with the first 10 rows of the result set.
What are two possible code segments that you can use to achieve the goal?
正確答案: A,C
說明:(僅 Fast2test 成員可見)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. You use the ADO.NET Entity Framework to model entities. You write the following code segment. (Line numbers are included for reference only.)
01 public partial class SalesOrderDetail : EntityObject
02 {
03 partial void OnOrderQtyChanging(short value)
04 {
05 ...
06 {
07 ...
08 }
09 }
10 }
You need to find out whether the object has a valid ObjectStateEntry instance. Which code segment should you insert at line 05?
01 public partial class SalesOrderDetail : EntityObject
02 {
03 partial void OnOrderQtyChanging(short value)
04 {
05 ...
06 {
07 ...
08 }
09 }
10 }
You need to find out whether the object has a valid ObjectStateEntry instance. Which code segment should you insert at line 05?
正確答案: B
說明:(僅 Fast2test 成員可見)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the ADO.NET Entity Framework Designer to model entities. The model contains an entity type
named Product.
You need to ensure that a stored procedure will be invoked when the ObjectContext.SaveChanges method
is executed after an attached Product has changed.
What should you do in the ADO.NET Entity Framework Designer?
You use the ADO.NET Entity Framework Designer to model entities. The model contains an entity type
named Product.
You need to ensure that a stored procedure will be invoked when the ObjectContext.SaveChanges method
is executed after an attached Product has changed.
What should you do in the ADO.NET Entity Framework Designer?
正確答案: B
說明:(僅 Fast2test 成員可見)
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server
2008 database.
The application uses nested transaction scopes. An inner transaction scope contains code that inserts
records into the database.
You need to ensure that the inner transaction can successfully commit even if the outer transaction rolls
back.
What are two possible TransactionScope constructors that you can use for the inner transaction to achieve
this goal?
(Each correct answer presents a complete solution. Choose two.)
2008 database.
The application uses nested transaction scopes. An inner transaction scope contains code that inserts
records into the database.
You need to ensure that the inner transaction can successfully commit even if the outer transaction rolls
back.
What are two possible TransactionScope constructors that you can use for the inner transaction to achieve
this goal?
(Each correct answer presents a complete solution. Choose two.)
正確答案: B,C
說明:(僅 Fast2test 成員可見)
You use Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL. The LINQ to SQL
model contains the Product entity.
A stored procedure named GetActiveProducts performs a query that returns the set of active products from
the database.
You need to invoke the stored procedure to return the active products, and you must ensure that the LINQ
to SQL context can track changes to these entities. What should you do?
model contains the Product entity.
A stored procedure named GetActiveProducts performs a query that returns the set of active products from
the database.
You need to invoke the stored procedure to return the active products, and you must ensure that the LINQ
to SQL context can track changes to these entities. What should you do?
正確答案: A
說明:(僅 Fast2test 成員可見)
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server
2008 database.
You need to ensure that the application connects to the database server by using SQL Server
authentication.
Which connection string should you use?
2008 database.
You need to ensure that the application connects to the database server by using SQL Server
authentication.
Which connection string should you use?
正確答案: C
說明:(僅 Fast2test 成員可見)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application contains the following XML document:
<bib> <book title="TCP/IP Illusrated" year="1994">
<author>Author1</author>
</book>
<book title="Programming in UNIX" year="1992">
<author>Author1</author>
<author>Author2</author>
<author>Author3</author>
</book>
<book title="Data on the web" year="2000">
<author>Author4</author>
<author>Author3</author>
</book> </bib>
You add the following code fragment. (Line numbers are included for reference only.)
01 public IEnumerable<XElement> GetBooks(string xml)
02 {
03 XDocument doc = XDocument.Parse(xml);
04 ...
05 }
You need to return a list of book XML element that are authored by Author1. Which code segment should you insert at line 04?
<bib> <book title="TCP/IP Illusrated" year="1994">
<author>Author1</author>
</book>
<book title="Programming in UNIX" year="1992">
<author>Author1</author>
<author>Author2</author>
<author>Author3</author>
</book>
<book title="Data on the web" year="2000">
<author>Author4</author>
<author>Author3</author>
</book> </bib>
You add the following code fragment. (Line numbers are included for reference only.)
01 public IEnumerable<XElement> GetBooks(string xml)
02 {
03 XDocument doc = XDocument.Parse(xml);
04 ...
05 }
You need to return a list of book XML element that are authored by Author1. Which code segment should you insert at line 04?
正確答案: B
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows
Communication Foundation (WCF) Data Services service.
The service connects to a Microsoft SQL Server 2008 database. The service is hosted by an Internet
Information Services (IIS) 6.0 Web server.
The application works correctly in the development environment. However, when you connect to the service
on
the production server, attempting to update or delete an entity results in an error.
You need to ensure that you can update and delete entities on the production server. What should you do?
Communication Foundation (WCF) Data Services service.
The service connects to a Microsoft SQL Server 2008 database. The service is hosted by an Internet
Information Services (IIS) 6.0 Web server.
The application works correctly in the development environment. However, when you connect to the service
on
the production server, attempting to update or delete an entity results in an error.
You need to ensure that you can update and delete entities on the production server. What should you do?
正確答案: D
說明:(僅 Fast2test 成員可見)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application uses the ADO.NET Entity Framework to model entities.
The application includes a Customer entity along with a CustomerKey property of the Guid type as shown in
the following exhibit:

You discover that when the application adds a new instance of a Customer, calling the SaveChanges
method
results in the following error message: "Server generated keys are only supported for identity columns."
You need to ensure that the application can add new Customer entities. What should you do?
The application uses the ADO.NET Entity Framework to model entities.
The application includes a Customer entity along with a CustomerKey property of the Guid type as shown in
the following exhibit:

You discover that when the application adds a new instance of a Customer, calling the SaveChanges
method
results in the following error message: "Server generated keys are only supported for identity columns."
You need to ensure that the application can add new Customer entities. What should you do?
正確答案: A
說明:(僅 Fast2test 成員可見)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that
uses the Entity Framework.
You create an Entity Data Model (EDM) named Model. You need to ensure that the Storage Schema
Definition Language (SSDL)
of the EDM can be modified without rebuilding the application. What should you do?
uses the Entity Framework.
You create an Entity Data Model (EDM) named Model. You need to ensure that the Storage Schema
Definition Language (SSDL)
of the EDM can be modified without rebuilding the application. What should you do?
正確答案: B
說明:(僅 Fast2test 成員可見)