Microsoft MCTS 70-516

Microsoft MCTS 70-516

Access Routing and LAN Switching;Advanced Routing and Switching;APE;APE for Validating Knowledge;Architecture;
CCDA;CCDE; CCDP;CCENT;CCIE;CCIE Data Center;CCIP; CCNA;
CCNA Security;CCNA Wireless;CCNA Voice;CCNP;CCNP Data Center
;CCNP Service Provider; CCNP Wireless;CCNP Security;CCNP SP Operations; CCNP Voice;CCSP;CCVP;Cisco Express Foundation Field Specialist;Cisco Security Sales Specialist;Cisco Specialist;Cisco Virtual Classroom;Connected Grid;Content Networking;Data-Center;Field Technician;IP Communications;IronPort; Network Management; Optical;Others
;Proctored Exams for Validating Knowledge;Sales Expert; Security Specialist;Service Provider Video;SMB;SP Video
;Storage Networking; Substation Automation;TelePresence Video
;Unified Communications;VPN and Security; WAASSE; Wireless LAN

70-516 TS: Accessing Data with .NET Framework 4 Der einfachste Weg für die IT-Prüfung vorzubereiten, ist die Praxis-Tests auf Zertifizierungsprüfung Muster zu nehmen und zu verstehen, die richtige sowie falsche Antwort Erklärungen Deine Zweifel klären. Lesen Sie dazu auch relevante technische Artikel zu versierter in der damit verbundenen Technologie.

Microsoft MCTS 70-516

QUESTION 1
You use .NET Framework 4.0 to develop an application that uses the Entity Framework.
The application defines the following Entity SQL (ESQL) query, which must be executed against the mode.

string prodQuery = “select value p from Products as p where p.ProductCategory.Name = @p0″;

You need to execute the query. Which code segment should you use?

A. var prods = ctx.CreateQuery(prodQuery,
new ObjectParameter(“p0″, “Road Bikes”)).ToList();
B. var prods = ctx.ExecuteStoreCommand(prodQuery,
new ObjectParameter(“p0″, “Road Bikes”)).ToList();
C. var prods = ctx.ExecuteFunction(prodQuery,
new ObjectParameter(“p0″, “Road Bikes”)).ToList();
D. var prods = ctx.ExecuteStoreQuery(prodQuery,
new ObjectParameter(“p0″, “Road Bikes”)).ToList();

Answer: A

Explanation/Reference:
CreateQuery – Creates an ObjectQuery in the current object context by using the specified query string.
ExecuteStoreCommand – Executes an arbitrary command directly against the data source using the existing connection.
ExecuteFunction(String, ObjectParameter[]) – Executes a stored procedure or function that is defined in the data source and
expressed in the conceptual model; discards any results returned from the function; and returns the number of rows affected by the execution.
ExecuteStoreQuery(String, Object[]) – Executes a query directly against the data source that returns a sequence of typed results.

ObjectContext.CreateQueryMethod
(http://msdn.microsoft.com/en-us/library/bb339670.aspx)

QUESTION 2
You use .NET Framework 4.0 to develop an application that connects to a 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.)

A. TransactionScope(TransactionScopeOption.Required)
B. TransactionScope()
C. TransactionScope(TransactionScopeOption.RequiresNew)
D. TransactionScope(TransactionScopeOption.Suppress)

Answer: CD

Explanation/Reference:
Required – A transaction is required by the scope. It uses an ambient transaction if one already exists.
Otherwise, it creates a new transaction before entering the scope. This is the default value.
RequiresNew – A new transaction is always created for the scope.
Suppress – The ambient transaction context is suppressed when creating the scope.
All operations within the scope are done without an ambient transaction context.

TransactionScopeOption Numeration
(http://msdn.microsoft.com/en-us/library/system.transactions.transactionscopeoption.aspx)

QUESTION 3
You use Visual Studio 2010 and .NET Framework 4.0 to develop an application that uses the Entity Framework.
Entity types in the model are generated by the Entity Data Model generator tool (EdmGen.exe).
You write the following code. (Line numbers are included for reference only.)

01 MemoryStream stream = new MemoryStream();
02 var query = context.Contacts.Include(“SalesOrderHeaders.SalesOrderDetails”);
03 var contact = query.Where(“it.LastName = @lastname”, new ObjectParameter(“lastname”, lastName)).First();
04 ….

You need to serialize the contact and all of its related objects to the MemoryStream so that the contact can be deserialized back into the model.
Which code segment should you insert at line 04?

A. var formatter = new XmlSerializer(typeof(Contact), new Type[]
{

typeof(SalesOrderHeader),

typeof(SalesOrderDetail)
});
formatter.Serialize(stream, contact);

B. var formatter = new XmlSerializer(typeof(Contact));
formatter.Serialize(stream, contact);

C. var formatter = new BinaryFormatter();
formatter.Serialize(stream, contact);

D. var formatter = new SoapFormatter();
formatter.Serialize(stream, contact);

Answer: A

Microsoft MCTS 70-516