RiaOlap
--------------------------------------------------------------------------------------------------------
Shows how you can use C1Olap with RIA data sources.

The C1Olap controls take any IEnumerable as a data source, so you can use them with RIA services as 
easily as you would with a simple List.

This sample was built following these steps:

1) Create a new Silverlight application. Make sure the "Enable RIA Services" checkbox is checked.

2) Create the ADO.NET Entity Data Model (to access the database on the server):

Right-click the web project in the new solution, select "Add New Item...", and select the 
"Data | ADO.NET Entity Data Model" item. Select the database you want to use, then select the tables 
and views.

Build the application. This is required for the next step.

3) Create the Domain Service Class (web service used to access the data from the client):

Right-click the web project in the new solution, select "Add New Item...", and select the
"Web | Domain Service Class" item. Select the tables and views you want to use in your application.

This will create code elements on the server and on the client projects. These elements allow 
the client to exchange data with the server.

On the server, there will be a DomainService1.cs and DomainService1.metadata.cs files. 
These implement a web service that exposes ObjectSet<> properties of the data context as serializable 
IQueryable objects.

On the client, there will be a hidden "Generated_Code" folder under the client app with a file called
[APP].Web.g.cs which contains the client context class used to access the web service.

4) Use the data on the client.

Now that the data model and service are complete, you can use them as follows:

<code>
    public MainPage()
    {
        InitializeComponent();

        // create olap page control, add it to the page
        var c1OlapPage = new C1.Silverlight.Olap.C1OlapPage();
        LayoutRoot.Children.Add(c1OlapPage);

        // load Invoices:
        var svc = new RiaOlap.Web.DomainService1(); // create service
        var query = svc.GetInvoicesQuery(); // get invoices query
        var loadOp = svc.Load(query); // load query data

        // when data is loaded, assign it to the c1OlapPage
        loadOp.Completed += (s, e) =>
            {
                if (loadOp.Error == null)
                {
					// assign data to olap page
                    c1OlapPage.DataSource = loadOp.Entities;
                }
                else
                {
					// inform user in case there were any errors
                    MessageBox.Show("Error loading data: " + loadOp.Error.Message);
                }
            };
    }
</code>

Notice that there is nothing in this code or project that is C1Olap-specific. The steps would
be exactly the same if you wanted to show the data in a regular DataGrid control (the only 
difference is in that case you would write grid.ItemsSource = loadOp.Entities).

Another option would be to add a DomainDataSource control to the page and bind the C1OlapPage 
to the DomainDataSource. The result would be the same, the main difference is you would be 
using more XAML and less C#.
