A ton of folks have asked us about getting the source code to Scott’s cool coding demo.
Note, there are a couple of prereqs:
- Sql Server 2008 to run it.. works great with the free Sql Express 2008
- .NET RIA Services March ’09 Preview
- Silverlight 3 Beta
Complete demo steps:
1. In Views/CustomersPage.xaml.cs, in OnNavigatedTo(), add the following:
var context = new CustomersDomainContext();
customersList.ItemsSource = context.Customers;
This code loads the data from the DomainService class on the server. Notice the data is loaded asynchronously, but no ugly, hard to debug async code is needed.
2. In CustomerDetailsPage.xaml.cs OnNavigatedTo, add this code:
this.DataContext = context;
int customerID = int.Parse(NavigationContext.QueryString[“CustomerID”]);
4. Then sign up for the SaveButton Click event (last line in the following XAML snippet):
5. In the code-behind CustomerDetailsPage.xaml.cs, add the following code to the newly-created event handler:
private void SaveButton_Click(object sender, RoutedEventArgs e)
Notice how simple it is to save all your pending changes back to the server. The client has kept up with what has changed and sends back a smart diff-gram.
7. Click one of the items in the DataGrid, show how the chart updates. Select something in another group in the DataGrid and show cool chart animation.
8. Click “Save” to save data in the DataForm back to the database.