Which two actions should you perform?

You are developing an application by using Silverlight 4 and Microsoft .NET Framework 4.
You create a Windows Communication Foundation (WCF) Data Service. You add a service reference to the WCF Data Service named NorthwindEntities in the Silverlight application. You also add a CollectionViewSource object named ordersViewSource in the Silverlight application.
You add the following code segment. (Line numbers are included for reference only.)

01 void getOrders_Click(object sender, RoutedEventArgs e)
02 {
03 var context = new NorthwindEntities();
04
05 var query = from order in context.Orders
06 select order;
07
08 }

You need to retrieve the Orders data from the WCF Data Service and bind the data to the ordersViewSource object. Which two actions should you perform?
(Each correct answer presents part of the solution. Choose two.)

You are developing an application by using Silverlight 4 and Microsoft .NET Framework 4.
You create a Windows Communication Foundation (WCF) Data Service. You add a service reference to the WCF Data Service named NorthwindEntities in the Silverlight application. You also add a CollectionViewSource object named ordersViewSource in the Silverlight application.
You add the following code segment. (Line numbers are included for reference only.)

01 void getOrders_Click(object sender, RoutedEventArgs e)
02 {
03 var context = new NorthwindEntities();
04
05 var query = from order in context.Orders
06 select order;
07
08 }

You need to retrieve the Orders data from the WCF Data Service and bind the data to the ordersViewSource object. Which two actions should you perform?
(Each correct answer presents part of the solution. Choose two.)

A.
Add the following code segment at line 04.
var obsCollection = new ObservableCollection<Order>();

B.
Add the following code segment at line 04.
var dsOrders = new DataServiceCollection<Order>();
dsOrders.LoadCompleted += new EventHandler<LoadCompletedEventArgs>(
(dsc, args) =>
{
});
ordersViewSource.Source = dsOrders;

C.
Add the following code segment at line 07. dsOrders.LoadAsync(query);

D.
Add the following code segment at line 07. dsOrders.Load(query);

E.
Add the following code segment at line 07. query.ToList().ForEach(o => obsCollection.Add(o)); ordersViewSource.Source = obsCollection;



Leave a Reply 0

Your email address will not be published. Required fields are marked *