QUESTION 171
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the Entity Framework Designer to create an Entity Data Model (EDM). You need to create a database creation script for the EDM. What should you do?
A. Use a new Self-Tracking Entities template.
B. Drag entities to Server Explorer.
C. Run the Generate Database command.
D. Select Run Custom Tool from the solution menu.
Answer: C
QUESTION 172
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?
A. SERVER=MyServer; DATABASE=AdventureWorks; Integrated Security=SSPI; UID=sa; PWD=secret;
B. SERVER=MyServer; DATABASE=AdventureWorks; UID=sa; PWD=secret;
C. SERVER=MyServer; DATABASE=AdventureWorks; Integrated Security=false;
D. SERVER=MyServer; DATABASE=AdventureWorks; Trusted Connection=true;
Answer: B
QUESTION 173
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database.
You add the following stored procedure to the database.
CREATE PROCEDURE dbo.GetClassAndStudents
AS
BEGIN
SELECT * FROM dbo.Class
SELECT * FROM dbo.Student
END
You create a SqIConnection named conn that connects to the database.
You need to fill a DataSet from the result that is returned by the stored procedure.
The first result set must be added to a DataTable named Class, and the second result set must be added to a DataTable named Student.
Which code segment should you use?
A. DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter(“GetClassAndStudents”, conn);
ds.Tables.Add(“Class”);
ds.Tables.Add(“Student”);
ad.Fill(ds);
B. DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter(“GetClassAndStudents”, conn);
ad.TableMappings.Add(“Table”, “Class”);
ad.TableMappings.Add(“Table1”, “Student”) ;
ad.Fill(ds) ;
C. DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter(“GetClassAndStudents”, conn);
ad.MissingMappingAction = MissingMappingAction.Ignore;
ad.Fill(ds, “Class”);
ad.Fill(ds, “Student”);
D. DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter(“GetClassAndStudents”, conn);
ad.Fill(ds);
Answer: B
QUESTION 174
You use Microsoft .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<Product>(prodQuery, new ObjectParameter(“p0″, “Road Bikes”)).ToList();
B. var prods = ctx.ExecuteStoreCommand(prodQuery, new ObjectParameter(“p0″, “Road Bikes”)).ToList();
C. var prods = ctx.ExecuteFunction<Product>(prodQuery, new ObjectParameter(“p0″, “Road Bikes”)).ToList();
D. var prods = ctx.ExecuteStoreQuery<Product>(prodQuery, new ObjectParameter(“p0″, “Road Bikes”)).ToList();
Answer: A
QUESTION 175
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.)
A. TransactionScope(TransactionScopeOption.Required)
B. TransactionScope()
C. TransactionScope(TransactionScopeOption.RequiresNew)
D. TransactionScope(TransactionScopeOption.Suppress)
Answer: CD
QUESTION 176
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. The database includes a table that contains information about all the employees.
The database table has a field named EmployeeType that identifies whether an employee is a Contractor or a Permanent employee.
You declare the Employee entity base type. You create a new Association entity named Contractor that inherits the Employee base type.
You need to ensure that all Contractors are bound to the Contractor class. What should you do?
A. Modify the .edmx file to include the following line of code:
<NavigationProperty Name=”Type” FromRole=”EmployeeType” ToRole=”Contractor” />
B. Modify the .edmx file to include the following line of code:
<Condition ColumnName=”EmployeeType” Value=”Contractor” />
C. Use the Entity Data Model Designer to set up an association between the Contractor class and EmployeeType.
D. Use the Entity Data Model Designer to set up a referential constraint between the primary key of the
Contractor class and EmployeeType.
Answer: B
QUESTION 177
You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database.
You use the ADO.NET LINQ to SQL model to retrieve data from the database. You use stored procedures to return multiple result sets.
You need to ensure that the result sets are returned as strongly typed values. What should you do?
A. Apply the FunctionAttribute and ResultTypeAttribute to the stored procedure function.
Use the GetResult<TElement> method to obtain an enumerator of the correct type.
B. Apply the FunctionAttribute and ParameterAttribute to the stored procedure function and directly access the strongly typed object from the results collection.
C. Apply the ResultTypeAttribute to the stored procedure function and directly access the strongly typed object from the results collection.
D. Apply the ParameterAttribute to the stored procedure function.
Use the GetResult<TElement> method to obtain an enumerator of the correct type.
Answer: A
QUESTION 178
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You create stored procedures by using the following signatures:
CREATE procedure [dbo].[Product_Insert](@name varchar(50),@price float)
CREATE procedure [dbo].[Product_Update](@id int, @name varchar(50), @price float)
CREATE procedure [dbo].[Product_Delete](@id int)
CREATE procedure [dbo].[Order_Insert](@productId int, @quantity int)
CREATE procedure [dbo].[Order_Update](@id int, @quantity int,@originalTimestamp timestamp)
CREATE procedure [dbo].[Order_Delete](@id int)
You create a Microsoft ADO.NET Entity Data Model (EDM) by using the Product and Order entities as shown in the exhibit:
You need to map the Product and Order entities to the stored procedures. To which two procedures should you add the @productId parameter?
(Each correct answer presents part of the solution. Choose two.)
A. Product_Delete
B. Product_Update
C. Order_Delete
D. Order_Update
Answer: CD
QUESTION 179
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use Plain Old CLR objects (POCO) to model your entities.
The application communicates with a Windows Communication Foundation (WCF) Data Services service.
You need to ensure that entities can be sent to the service as XML. What should you do?
A. Apply the virtual keyword to the entity properties.
B. Apply the [Serializable] attribute to the entities.
C. Apply the [DataContract(IsReference = true)] attribute to the entities.
D. Apply the [DataContract(IsReference = false)] attribute to the entities.
Answer: C
QUESTION 180
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.
You need to create a database from your model. What should you do?
A. Run the edmgen.exe tool in FullGeneration mode.
B. Run the edmgen.exe tool in FromSSDLGeneration mode.
C. Use the Update Model Wizard in Visual Studio.
D. Use the Generate Database Wizard in Visual Studio. Run the resulting script against a Microsoft SQL Server database.
Answer: D
All Free Pass4sure PDF & VCE 70-516 Exam Questions