Ensurepass
Free VCE & PDF File for Microsoft 70-516 Real Exam
Instant Access to Free VCE Files: MCSE|MCSA|MCITP…
Instant Access to Free PDF Files: MCSE|MCSA|MCITP…
QUESTION 151
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that will access a WCF data service. The solution contains the projects shown in the following table.
The WCF data service exposes an Entity Framework model.
You need to access the service by using a WCF Data Services client.
What should you do in the Application.Client project?
A. |
Add a reference to the Application.Model project. |
B. |
Add a reference to the Application.Service project. |
C. |
Add a service reference that uses the URL of the WCF data service. |
D. |
Add a Web reference that uses the URL of the WCF data service. |
Correct Answer: C
QUESTION 152
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application retrieves data from a Microsoft SQL Server 2008 database named AdventureWorks. The AdventureWorks.dbo.ProductDetails table contains a column named ProductImages that uses a varbinary(max) data type.
You write the following code segment. (Line numbers are included for reference only.)
01 SqlDataReader reader =
02 command.ExecuteReader(
03
04 );
05 while (reader
.Read())
06 {
07 pubID = reader.GetString(0);
08 stream = new FileStream(
09 …
10 );
11 writer = new BinaryWriter(stream);
12 startIndex = 0;
13 retval = reader.GetBytes(1, startIndex, outByte, 0, bufferSize);
14 while (retval == bufferSize)
15 {
16 …
17 }
18 writer.Write(outByte, 0, (int)retval – 1);
19 writer.Flush();
20 writer.Close();
21 stream.Close();
22 }
You need to ensure that the code supports streaming data from the ProductImages column.
Which code segment should you insert at line 03?
A. |
CommandBehavior.Default |
B. |
CommandBehavior.KeyInfo |
C. |
CommandBehavior.SingleResult |
D. |
CommandBehavior.SequentialAccess |
Correct Answer: D
Explanation:
Default
The query may return multiple result sets. Execution of the query may affect the database state.
Default sets no CommandBehavior flags, so calling ExecuteReader(CommandBehavior.Default) is functionally equivalent to calling ExecuteReader(). KeyInfo The query returns column and primary key information. When KeyInfo is used for command execution, the provider will append extra columns to the result set for existing primary key and timestamp columns.
SingleResult The query returns a single result set. SequentialAccess Provides a way for the DataReader to handle rows that contain columns with large binary values.
Rather than loading the entire row, SequentialAccess enables the DataReader to load data as a stream.
You can then use the GetBytes or GetChars method to specify a byte location to start the read operation, and a limited buffer size for the data being returned.
CommandBehavior Enumeration
http://msdn.microsoft.com/en-us/library/system.data.commandbehavior.aspx
QUESTION 153
You use Microsoft Visual Studio 2010 to create a Microsoft .NET Framework 4 application. You create an Entity Data Model for the database tables shown in the following diagram.
You need to modify the .edmx file so that a many-to-many association can exist between the Address and Customer entities.
Which storage Model section of the .edmx file should you include?
A. |
<EntityType Name=”CustomerAddress”> <Key> <PropertyRef Name=”CustomerAddressID” /> <PropertyRef Name=”CustomerID” /> <PropertyRef Name=”AddressID” /> </Key> <Property Name=”CustomerAddressID” Type=”int” Nullable=”false” StoreGeneratedPattern=”Identity” /> <Property Name=”CustomerID” Type=”int” Nullable=”false”/> <Property Name=”AddressID” Type=”int” Nullable=”false”/> <Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50/> </EntityType> |
B. |
<EntityType Name=”CustomerAddress”> <Key> <PropertyRef Name=”CustomerID” /> <PropertyRef Name=”AddressID” /> </Key> <Property Name=”CustomerID” Type=”int” Nullable=”false” /> <Property Name=”AddressID” Type=”int” Nullable=”false” /> <Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50 DefaultValue=”Home” /> </EntityType> |
C. |
<EntityType Name=”CustomerAddress”> <Key> <PropertyRef Name=”CustomerAddressID” /> </Key> <Property Name=”CustomerAddressID” Type=”int” Nullable=”false” StoreGeneratedPattern=”Identity” /> <Property Name=”CustomerID” Type=”int” Nullable=”false”/> <Property Name=”AddressID” Type=”int” Nullable=”false” /> <Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50/> </EntityType> |
D. |
<EntityType Name=”CustomerAddress”> <Key> <PropertyRef Name=”CustomerID” / > <PropertyRef Name=”AddressID” /> </Key> <Property Name=”CustomerID” Type=”int” Nullable=”false”/> <Property Name=”AddressID” Type=”int” Nullable=”false”/> <Property Name=”AddressType” Type=”nvarchar” Nullable=”false” MaxLength=”50″ /> </EntityType> |
Correct Answer: D
QUESTION 154
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to two different Microsoft SQL Server 2008 database servers named Server1 and Server2. A string named sql1 contains a connection string to Server1. A string named sql2 contains a connection string to Server2.
01 using (TransactionScope scope = new
02…
03 )
04 {
05 using (SqlConnection cn1 = new SqlConnection(sql1))
06 {
07 try{
08…
09 }
10 catch (Exception ex)
11 {
12 }
13 }
14 scope.Complete();
15 }
You need to ensure that the application meets the following requirements:
There is a SqlConnection named cn2 that uses sql2.
The commands that use cn1 are initially enlisted as a lightweight transaction.
The cn2 SqlConnection is enlisted in the same TransactionScope only if commands executed by cn1 do not throw an exception.
What should you do?
A. |
Insert the following code segment at line 02. TransactionScope(TransactionScopeOption.Suppress) Insert the following code segment at line 08. using (SqlConnection cn2 = new SqlConnection(sql2)) { try { cn2.Open(); … cn1.Open(); … } catch (Exception ex){} } |
B. |
Insert the following code segment at line 02. TransactionScope(TransactionScopeOption.Suppress) Insert the following code segment at line 08. cn1.Open(); … using (SqlConnection cn2 = new SqlConnection(sql2)) { try { cn2.Open(); … } catch (Exception ex){} } |
C. |
Insert the following code segment at line 02. TransactionScope(TransactionScopeOption.RequiresNew) Insert the following code segment at line 08. using (SqlConnection cn2 = new SqlConnection(sql2)) { try{ cn2.Open(); … cn1.Open(); … } catch (Exception ex){} } |
D. |
Insert the following code segment at line 02. TransactionScope(TransactionScopeOption.RequiresNew) Insert the following code segment at line 08. cn1.Open(); … using (SqlConnection cn2 = new SqlConnection(sql2)) { try { cn2.Open(); … } catch (Exception ex){} } |
Correct Answer: B
Explanation:
Seen in exam
Here cn1 is for the Ambient Transaction (i.e the lightweight or logical transaction) that will be used run the 2 transactions in the ambient scope. If the cn1 transaction fails, then the requirement is for the cn2 transaction NOT to join the ambient transaction. It needs to run within its own independent transaction. This is achieved by using TransactionScopeOption.
Suppress.
If the cn2 transaction does NOT fail, then both transactions will run under the ambient Transaction.
TransactionScopeOption
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.
QUESTION 155
You are developing a Microsoft .NET Framework 4 application. You create an Entity Data Model (EDM) by using the Microsoft ADO.NET Entity Data Model Designer (Entity Designer). The EDM contains a complex type.
You need to map a stored procedure to the complex type by using the Entity Designer.
What should you do?
A. |
Add an association to the stored procedure. |
B. |
Add a code generation item that has the name of the stored procedure. |
C. |
Add a function import for the stored procedure. |
D. |
Add an entity that mirrors the properties of the complex type. |
Correct Answer: C
QUESTION 156
You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 200B database.
You need to ensure that the application connects to the database server by using SQL Server authentication.
Which connection string should you use?
A. |
SERVER=MyServer; DATABASE=AdventureUorks; Integrated Security=SSPI; UID=sa; PWD=secret |
B. |
SERVER-MyServer; DATABASE-AdventureWorks; UID=sa; PWD=secret |
C. |
SERVER-HyServec; DATABASE-AdventureUocks; Integrated Security=false |
D. |
SERVER-HyServer; DATABASE-AdventureWorks; Trusted Connection”true |
Correct Answer: B
Explanation:
SQL Server autentification using the passed-in user name and password. User ID, Uid, User, Password, Pwd Connection String Syntax (ADO.NET)
http://msdn.microsoft.com/en-us/library/ms254500.aspx
QUESTION 157
You are developing a WCF data service that will expose an existing Entity Data Model (EDM).
You have the following requirements:
Users must be able to read all entities that are exposed in the EDM.
Users must be able to update or replace the SalesOrderHeader entities.
Users must be prevented from inserting or deleting the SalesOrderHeader entities
You need to ensure that the data service meets the requirements.
Which code segment should you use in the Initialize method?
A. |
config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead); config.SetEntitySetAccessRule (“SalesOrderHeader”, EntitySetRights.AllWrite); |
B. |
config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead); config.SetEntitySetAccessRule (“SalesOrderHeader”, EntitySetRights.WriteMerge | EntitySetRights.WriteRep lace); |
C. |
config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead); config.SetEntitySetAccessRule (“SalesOrderHeader”, EntitySetRights.WriteAppend | EntitySetRights.WriteDelete); |
D. |
config.SetEntitySetAccessRule(“*”, EntitySetRights.AllRead); config.SetEntitySetAccessRule (“SalesOrderHeader”, EntitySetRights.All); |
Correct Answer: B
Explanation:
http://msdn.microsoft.com/en-us/library/system.data.services.entitysetrights.aspx
http://msdn.microsoft.com/en-us/library/ee358710.aspx
QUESTION 158
You have a LINQ to SQL model.
You create an entity named Employee by dragging a table from Server Explorer to a design surface named MyStore.dbml.
You need to identify the class definition of the Employee class.
Which class definition should you identify?
A. |
public partial class Employee : EntityRef |
B. |
public partial class Employee : INotifyPropertyChanging, INotifyPropertyChanged |
C. |
public partial class Employee : EntitySet |
D. |
public partial class Employee : DataContext |
Correct Answer: B
QUESTION 159
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application.
You use the Entity Framework Designer to create an Entity Data Model using model-first development.
The database has the following requirements:
Each table must have a datetime column named time_modified.
Each table requires a trigger that updates the value of the time_modified column when a row is inserted or updated.
You need to ensure that the database script that is created by using the Generate Database From Model option meets the requirements.
What should you do?
A. |
Add a DateTime property named time_modified to each entity in the model, and set the property’s StoreGeneratedPattern to Computed. |
B. |
Add a new entity named time_modified to the model, and modify each existing entity so that it inherits from the new entity. |
C. |
Create a new T4 Template, and set the DDL Generation template to the name of the new template. |
D. |
reate a new Windows Workflow Foundation workflow, and set Database Generation Workflow to the name of the new workflow. |
Correct Answer: C
Explanation:
Model-First in the Entity Framework 4
http://msdn.microsoft.com/en-us/data/ff830362
QUESTION 160
You have an Entity Framework ObjectContext named Contextl. Contextl manages a class named Order. You create the following code:
You need to ensure that any changes made to the Order parameter are saved correctly.
Which code segment should you insert at line 07?
A. |
Option A |
B. |
Option B |
C. |
Option C |
D. |
Option D |
Correct Answer: B
70-410 Dumps VCE PDF
70-411 Dumps VCE PDF
70-412 Dumps VCE PDF
70-413 Dumps VCE PDF
70-414 Dumps VCE PDF
70-417 Dumps VCE PDF
70-461 Dumps VCE PDF
70-462 Dumps VCE PDF
70-463 Dumps VCE PDF
70-464 Dumps VCE PDF
70-465 Dumps VCE PDF
70-480 Dumps VCE PDF
70-483 Dumps VCE PDF
70-486 Dumps VCE PDF
70-487 Dumps VCE PDF