070-516 無料問題集「Microsoft TS: Accessing Data with Microsoft .NET Framework 4」
You are a tasked with performing a code review. The business rule is the following:
-If INSERTs into the first table succeed, then INSERT into the second table.
-However, if the INSERTs into the second table fail, roll back the inserts in the second table but do not roll back the inserts in the first table.
-Although this can also be done by way of regular transactions, It needs to be performed using
TransactionScope objects.
Whis code would fit this business rule?
-If INSERTs into the first table succeed, then INSERT into the second table.
-However, if the INSERTs into the second table fail, roll back the inserts in the second table but do not roll back the inserts in the first table.
-Although this can also be done by way of regular transactions, It needs to be performed using
TransactionScope objects.
Whis code would fit this business rule?
正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
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. The application uses the ADO.NET Entity
Framework to model entities.
The database includes objects based on the exhibit.
The application includes the following code segment. (Line numbers are included for reference only.)
01 using (AdventureWorksEntities context = new AdventureWorksEntities()){
02 ...
03 foreach (SalesOrderHeader order in customer.SalesOrderHeader){
04 Console.WriteLine(String.Format("Order: {0} ",
order.SalesOrderNumber));
05 foreach (SalesOrderDetail item in order.SalesOrderDetail){
06 Console.WriteLine(String.Format("Quantity: {0} ", item.Quantity));
07 Console.WriteLine(String.Format("Product: {0} ",
item.Product.Name));
08 }
09 }
10 }
You want to list all the orders for a specified customer. You need to ensure that the list contains the following fields:
-Order number
-Quantity of products
-Product name
Which code segment should you insert at line 02?
The application connects to a Microsoft SQL Server database. The application uses the ADO.NET Entity
Framework to model entities.
The database includes objects based on the exhibit.
The application includes the following code segment. (Line numbers are included for reference only.)
01 using (AdventureWorksEntities context = new AdventureWorksEntities()){
02 ...
03 foreach (SalesOrderHeader order in customer.SalesOrderHeader){
04 Console.WriteLine(String.Format("Order: {0} ",
order.SalesOrderNumber));
05 foreach (SalesOrderDetail item in order.SalesOrderDetail){
06 Console.WriteLine(String.Format("Quantity: {0} ", item.Quantity));
07 Console.WriteLine(String.Format("Product: {0} ",
item.Product.Name));
08 }
09 }
10 }
You want to list all the orders for a specified customer. You need to ensure that the list contains the following fields:
-Order number
-Quantity of products
-Product name
Which code segment should you insert at line 02?
正解:C
解答を投票する
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the Entity Framework Designer to create the following Entity Data Model.

You write a method named ValidatePostalCode to validate the postal code for the application.
You need to ensure that the ValidatePostalCode method is called before the PostalCode property set
method is completed and before the underlying value has changed.
Which code segment should you place in the entity's partial class?

You write a method named ValidatePostalCode to validate the postal code for the application.
You need to ensure that the ValidatePostalCode method is called before the PostalCode property set
method is completed and before the underlying value has changed.
Which code segment should you place in the entity's partial class?
正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
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 GetSalesPeople AS BEGIN
SELECT FirstName, LastName, Suffix, Email, Phone FROM SalesPeople END
You write the following code segment. (Line numbers are included for reference only.)
01 SqlConnection connection = new SqlConnection("...");
02 SqlCommand command = new SqlCommand("GetSalesPeople", connection);
03 command.CommandType = CommandType.StoredProcedure;
04 ...
You need to retreive all of the results from the stored procedure. Which code segment should you insert at line 04?
The application connects to a Microsoft SQL Server 2008 database. You add the following store procedure
to the database.
CREATE PROCEDURE GetSalesPeople AS BEGIN
SELECT FirstName, LastName, Suffix, Email, Phone FROM SalesPeople END
You write the following code segment. (Line numbers are included for reference only.)
01 SqlConnection connection = new SqlConnection("...");
02 SqlCommand command = new SqlCommand("GetSalesPeople", connection);
03 command.CommandType = CommandType.StoredProcedure;
04 ...
You need to retreive all of the results from the stored procedure. Which code segment should you insert at line 04?
正解:D
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You use Microsoft Visual Studio 2010 and the Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database. The application uses DataContexts to query
the database.
You define a foreign key between the Customers and Orders tables in the database.
You need to ensure that when you delete a customer record, the corresponding order records are deleted.
You want to achieve this goal by using the minimum amount of development effort. What should you do?
The application connects to a Microsoft SQL Server database. The application uses DataContexts to query
the database.
You define a foreign key between the Customers and Orders tables in the database.
You need to ensure that when you delete a customer record, the corresponding order records are deleted.
You want to achieve this goal by using the minimum amount of development effort. What should you do?
正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You use Microsoft .NET Framework 4.0 to develop an application that connects to a local Microsoft SQL
Server 2008 database.
The application can access a high-resolution timer. You need to display the elapsed time, in sub-
milliseconds (<1 millisecond),
that a database query takes to execute. Which code segment should you use?
Server 2008 database.
The application can access a high-resolution timer. You need to display the elapsed time, in sub-
milliseconds (<1 millisecond),
that a database query takes to execute. Which code segment should you use?
正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows
Communication Foundation (WCF) Data Services service.
WCF Data Services uses an authentication scheme that requires an HTTP request that has the following
header format:
GET /Odata.svc/Products(1)
Authorization: WRAP access_token="123456789"
The application includes the following code. (Line numbers are included for reference only.)
01 public class program
02 {
03 Public void GetProducts()
04 {
05 var proxy = new MyDataServiceContext("...");
06 ...
07 }
08 }
You need to ensure that the correct authentication header is present when requests are made by using
MyDataServiceContext.
What should you do?
Communication Foundation (WCF) Data Services service.
WCF Data Services uses an authentication scheme that requires an HTTP request that has the following
header format:
GET /Odata.svc/Products(1)
Authorization: WRAP access_token="123456789"
The application includes the following code. (Line numbers are included for reference only.)
01 public class program
02 {
03 Public void GetProducts()
04 {
05 var proxy = new MyDataServiceContext("...");
06 ...
07 }
08 }
You need to ensure that the correct authentication header is present when requests are made by using
MyDataServiceContext.
What should you do?
正解:C
解答を投票する