QUESTION 271You use Microsoft Visual Studio 2010 and Microsoft NET framework 4 to create an application the application uses the ADO NET entity framework to model entities.You define a Category class by writing the following code segment (Line numbers are included for reference only) Public Class Category01 Public Class Category02 Public Property CategorylDO As Integer03 Get04 End Get05 Set06 End Set07 End Property08 Public Property CategoryName() As String09 Get10 End Get11 Set12 End Set13 End Property14 Public Property Description() As String15 Get16 End Get17 Set18 End Set19 End Property20 Public Property Picture() As Byte()21 Get22 End Get23 Set24 End Set 2526 End PropertyYou need to add a collection named Products to the Category class.You also need to ensure that the collection supports deterred loading.Which code segment should you insert at line 25?

QUESTION 272You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application.You are creating the data layer of the application.You write the following code segment. (Line numbers are included for reference only.)01Public Shared Function GetDataReader(sql As String) As SqlDataReader02Dim dr As SqlDataReader = Nothing04Return dr05End FunctionYou need to ensure that the following requirements are met:The SqlDataReader returned by the GetDataReader method can be used to retrieve rows from the database.SQL connections opened within the GetDataReader method will close when the SqlDataReader is closed.Which code segment should you insert at line 03?

A. Using cnn As New SqlConnection(strCnn)TryDim cmd As New SqlCommand(sql, cnn)cnn.Open()dr = cmd.ExecuteReader()CatchThrowEnd TryEnd UsingB. Dim cnn As New SqlConnection(strCnn)Dim cmd As New SqlCommand(sql, cnn)cnn.Open()Trydr = cmd.ExecuteReader()Finallycnn.Close()End TryC. Dim cnn As New SqlConnection(strCnn)Dim cmd As New SqlCommand(sql, cnn)cnn.Open()Trydr = cmd.ExecuteReader()cnn.Close()CatchThrowEnd TryD. Dim cnn As New SqlConnection(strCnn)Dim cmd As New SqlCommand(sql, cnn)cnn.Open()Trydr = cmd.ExecuteReader(CommandBehavior.CloseConnection) Catchcnn.Close()ThrowEnd Try

QUESTION 273Hotspot QuestionYou create an Entity Data Model (EDM) named ModelContoso.You need to generate a Transact-SQL script to create a database to store ModelContoso. The solution must ensure that table names are prefixed automatically with TBL_.Which property of ModelContoso should you modify? (To answer, select the appropriate property in the answer area.)

Answer:

QUESTION 274You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Microsoft Windows Forms application,You plan to deploy the application to several shared client computers.You write the following code segment. (Line numbers are included for reference only.)01 Dim config As Configuration = Conf igurationManager .OpenExeConf iguratlon(exeConf igName)03 config.Save()04 …You need to encrypt the connection string stored in the .config file.Which code segment should you insert at line 02?

Answer: BExplanation:You encrypt and decrypt the contents of a Web.config file by using System.Configuration . DPAPIProtectedConfigurationProvider, which uses the Windows Data Protection API (DPAPI) to encrypt and decrypt data, or System.Configuration. RSAProtectedConfigurationProvider, which uses the RSA encryption algorithm to encrypt and decrypt data. When you use the same encrypted configuration file on many computers in a Web farm, only System.Configuration.RSAProtectedConfigurationProvider enables you to export theencryption keys that encrypt the data and import them on another server. This is the default setting.CHAPTER 2 ADO.NET Connected ClassesLesson 1: Connecting to the Data StoreStoring Encrypted Connection Strings in Web Applications (page 76)Securing Connection Strings(http://msdn.microsoft.com/en-us/library/89211k9b(v=vs.80).aspx)

QUESTION 275Drag and Drop QuestionYou have an application that queries a Microsoft Access database. The database contains a table named Tablel. Tablel contains a column named Columnl. A variable named Variablel is used to store a user input string.You need to retrieve the rows from Tablel if the value in Columnl is equal to Variablel. The solution must protect against a SQL injection attack.What should you do? (Develop the solution by selecting and ordering the required code snippets. You may not need all of the code snippets.)

Answer:

QUESTION 276You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database.You add the following stored procedure to the database.CREATE PROCEDURE GetSalesPeopleASBEGINSELECT FirstName, LastName, Suffix, Email, PhoneFROM SalesPeopleENDYou write the following code. (Line numbers are included for reference only.)01Dim connection As SqlConnection = New SqlConnection(“& “)02Dim command As SqlCommand = New SqlCommand(“GetSalesPeople”, connection)03command.CommandType = CommandType.StoredProcedureYou need to retrieve all of the results from the stored procedure.Which code segment should you insert at line 04

QUESTION 277Drag and Drop QuestionYou use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You have the following stored procedure:

You need to return a list of customers who match a given order date. The solution must meet the following requirements:Use a forward-only data object.Use a read-only data object.What should you do? (To answer, drag the appropriate code segments to the correct locations. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)

Answer: CExplanation:DescendantNodes() Returns a collection of the descendant nodes for this document or element, in document order.Descendants() Returns a collection of the descendant elements for this document or element, indocument order.Nodes() Returns a collection of the child nodes of this element or document, in document order.NodesAfterSelf() Returns a collection of the sibling nodes after this node, in document order.

QUESTION 279Drag and Drop QuestionYou have a Cable named Tablel that contains two columns named Columnl and Column2. Columnl contains string data. Column2 contains image files.You create the following code:

What code should you use? (To answer, drag the appropriate elements to the correct locations. Each element may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)

Answer:

QUESTION 280You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. You use the ADO.NET Entity Framework Designer to model entities.You need to associate a previously deserialized entity named personl to an object context named model and persist changes to the database.Which code segment should you use?

Answer: CExplanation:Cosiderations from Attaching and Detaching objects (http://msdn.microsoft.com/en-us/library/bb896271.aspx):The object that is passed to the Attach method must have a valid EntityKey value. If the object does not have a valid EntityKey value, use the AttachTo method to specify the name of the entity set.Attach Use the Attach method of ObjectContext where the method accepts a single typed entity parameter.AttachTo The AttachTo method of ObjectContext accepts two parameters. The first parameter is a string containing the name of the entity set.The second parameter’ type is object and references the entity you want to add.Attach The Attach method of ObjectSet, which is the entity set’ type, accepts a single typed parameter containing the entity to be added to the ObjectSet.CHAPTER 6 ADO.NET Entity FrameworkLesson 2: Querying and Updating with the Entity FrameworkAttaching Entities to an ObjectContext(page 437)Attaching and Detaching objects(http://msdn.microsoft.com/en-us/library/bb896271.aspx)http://msdn.microsoft.com/en-us/library/bb896248(v=vs.90).aspxhttp://msdn.microsoft.com/en-us/library/bb896248.aspx

Braindump2go 70-516 Latest Updaed Braindumps Including All New Added 70-516 Exam Questions from Exam Center which Guarantees You Can 100% Success 70-516 Exam in Your First Try Exam!