PrepAway - Latest Free Exam Questions & Answers

Category: 70-516

Exam 70-516: TS: Accessing Data with Microsoft .NET Framework 4

What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use Microsoft ADO.NET Entity Data Model (EDM) to model entities.
You create an entity named Person with a schema defined by the following XML fragment.

<EntityType Name=”CPerson”>
<Key>
<PropertyRef Name=”PersonId” />
</Key>
<Property Name=”PersonId” Type=”Int32″ Nullable=”false” />
<Property Name=”CompanyName” Type=”String” />
<Property Name=”ContactName” Type=”String” />
<Property Name=”ContactTitle” Type=”String” />
<Property Name=”Address” Type=”String” />
</EntityType>

You need to ensure that entities within the application are able to add properties related to the city, region, and country of Person’s address.
What should you do?

What should you do next?

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 use the ADO.NET LINQ to Entity model to retrieve data from the database.
You need to call a function that is defined in the conceptual model from within the LINQ to Entities queries.
You create a common language runtime (CLR) method that maps to the function. What should you do next?

Which code segment should you insert at line 11?

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 write the following code segment that executes two commands against the database within a transaction.
(Line numbers are included for reference only.)

01 using(SqlConnection connection = new SqlConnection(cnnStr)) {
02 connnection.Open();
03 SqlTransaction sqlTran = connection.BeginTransaction();
04 SqlCommand command = connection.CreateCommand();
05 command.Transaction = sqlTran;
06 try{
07 command.CommandText = INSERT INTO Production.ScrapReason(Name) VALUES(Wrong size);
08 command.ExecuteNonQuery();
09 command.CommandText = INSERT INTO Production.ScrapReason(Name) VALUES(Wrong color);
10 command.ExecuteNonQuery();
11 …
l2 }

You need to log error information if the transaction fails to commit or roll back. Which code segment should you insert at line 11?

Which code segment should you insert at line 04?

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 following object query to load a product from the database.
(Line numbers are included for reference only.)

01 using (AdventureWorksEntities advWorksContext = new AdventureWorksEntities())
02 {
03 ObjectQuery <Product> productQuery = advWorksContext.Product.Where(“it.ProductID = 900”);
04 …
05 }

You need to log the command that the query executes against the data source. Which code segment should you insert at line 04?

Which code segment should you insert at line 11?

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. The application connects to a Microsoft SQL Server database named AdventureWorks.
The application includes the following code segment. (Line numbers are included for reference only.)

01 using (AdventureWorksEntities context = new AdventureWorksEntities())
02 {
03 ObjectQuery <SalesOrderHeader> orders = context.SalesOrderHeader.
Where(“it.CreditCardApprovalCode IS NULL”).Top(“100”);
04 foreach (SalesOrderHeader order in orders){
05 order.Status = 4;
06 }
07 try {
08 context.SaveChanges();
09 }
10 catch (OptimisticConcurrencyException){
11 …
12 }
13 }

You need to resolve any concurrency conflict that can occur. You also need to ensure that local changes are persisted to the database.
Which code segment should you insert at line 11?

What should you do?

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?

Which ObjectContext method should you call?

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 your entities.
You use Plain Old CLR Objects (POCO) entities along with snapshot-based change tracking. The code accesses the POCO entities directly.
You need to ensure that the state manager synchronizes when changes are made to the object graph.
Which ObjectContext method should you call?

What should you do?

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 LINQ to SQL model to retrieve data from the database.
The application will not modify retrieved data. You need to ensure that all the requested data is retrieved.
You want to achieve this goal using the minimum amount of resources. What should you do?

What should you do?

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 allows users to make changes while disconnected from the data store.
Changes are submitted to the data store by using the SubmitChanges method of the DataContext object.
You receive an exception when you call the SubmitChanges method to submit entities that a user has changed in offline mode.
You need to ensure that entities changed in offline mode can be successfully updated in the data store.
What should you do?


Page 17 of 19« First...10...1516171819