Which code segment should you use?
The database contains orphaned Color records that are no longer connected to Part records.
You need to clean up the orphaned records. You have an existing ContosoEntities context object named context.
Which code segment should you use?
What should you do?
You are implementing an ASP.NET Web application that retrieves data from a Microsoft SQL Server database.
You add a page that includes the following data source control.
<asp:SqlDataSource id=”sqlds” runat=”server” ConnectionString=”<%$ ConnectionStrings:MyDB %>” SelectCommand=”SELECT * FROM Companies” />
The page is accessed frequently, but the data in the database rarely changes.
You need to cache the retrieved data so that the database is not queried each time the Web page is accessed.
What should you do?
What should you do?
You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4 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?
What should you do?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application contains the following code segment. (Line numbers are included for reference only.)
01 Class DataAccessLayer
02 Private Shared connString As String
03 04 …
05 Public Shared Function GetDataTable(command As String) As DataTable
06 07 …
08 End Function
09 End Class
You need to define the connection life cycle of the DataAccessLayer class. You also need to ensure that the application uses the minimum number of connections to the database. What should you do?
Which code segment should you use?
You are developing a new feature that displays an auto-complete list to users as the type color names. You have an
existing ContosoEntities context object named contex.
To support the new feature you must develop code that will accept a string object named text containing a user’s
partial input and will query the Colors database table to retrieve all color names that begin with that input.
You need to create an Entity SQL (ESQL) query to meet the requirement.
The query must not be vulnerable to a SQL injection attack. Which code segment should you use?
What should you do?
You are implementing an ASP.NET page.
You add and configure the following ObjectDataSource.
<asp:ObjectDataSource SelectMethod=”GetProductByProductId” ID=”odc” runat=”server” TypeName=”ProductDAL”>
<SelectParameters>
<asp:Parameter Name=”productId” Type=”Int32″ />
</SelectParameters>
</asp:ObjectDataSource>
The page will be called with a query string field named pid.
You need to configure the ObjectDataSource control to pass the value of the pid field to GetProductsByProductId method.
What should you do?
Which code segment should you insert at line 03?
You use Microsoft Visual Studio 2010, Microsoft Sync Framework, and Microsoft .NET Framework 4 to create an application. You have a ServerSyncProvider connected to a Microsoft SQL Server database. The database is hosted on a Web server. Users will use the Internet to access the Customer database through the ServerSyncProvider. You write the following code segment. (Line numbers are included for reference only.)
01SyncTable customerSyncTable = new SyncTable(“Customer”);
02customerSyncTable.CreationOption = TableCreationOption. UploadExistingOrCreateNewTable;
03
04customerSyncTable.SyncGroup = customerSyncGroup;
05 this.Configuration.SyncTables.Add(customerSyncTable);
You need to ensure that the application meets the following requirements: “Users can modify data locally and receive changes from the server. “Only changed rows are transferred during synchronization. Which code segment should you insert at line 03?
What should you do?
You use Microsoft .NET Framework to create a Windows Presentation Foundation (WPF) application. You create a window that contains a Button control and a MenuItem control. Both controls are labeled “Add sugar.” The Command properties of the Button and MenuItem controls are set to the same RoutedCommand named AddSugarCommand. You write the following code segment.
Private Sub CanAddSugar(sender As Object, e As CanExecuteRoutedEventArgs) …
End Sub
You need to ensure that when the CanAddSugar method sets e.CanExecute to false, the MenuItem and Button controls are disabled. What should you do?
Which expression should you use?
The application must provide a component part list for any product. The component part list must give the quantity of
each distinct part that is required to manufacture that product.
You need to create a LINQ expression that delivers a a result of type IEnumerable<Tuple<int,Part>> to meet the requirements.
Which expression should you use?
Which code segment should you use?
You are implementing an ASP.NET page.
The page includes a method named GetCustomerOrderDataSet that returns a DataSet.
The DataSet includes a DataTable named CustomerDetailsTable and a DataTable named OrderDetailsTable.
You need to display the data in OrderDetailsTable in a DetailsView control named dtlView.
Which code segment should you use?