Hosting servers generally do not have Visual Studio 2010 or Silverlight SDK installed, this might be a blocker for some hosting companies.
The RIAServices msi now has a command line override, especially for hosters. The msi is now configured to take a “Server” command line parameter that will only check for .NET Framework 4.0. The command line parameter will install all the RIA Services server assemblies.
Here is how to use this option:-
1: msiexec /i RIAServices.msi SERVER=true
Using this option will do the following, install the server assemblies along with adding them to the Global assembly cache and to the native cache (ngen).
Keep in mind, using this option will not install any of the Silverlight or Tooling components.
BTW here are some of the hosters that will be supporting RIA Services:-
DiscountASP - http://labs.discountasp.net/
OrcsWeb - http://vs2010host.com/
ASPHostCentral - http://asphostcentral.com/
At Mix 2010, ScottGu talked about the developer story of Windows Phone 7. As you know by now, that the developer story is on Silverlight. I have also seen some questions regarding Windows Phone and whether RIA Services can be used part in it.
Unfortunately, there is no in built support for the Mobile platform in RIA Services V1.0. I know that is a big bummer because every Silverlight developer is now a windows phone developer. Rest assured we do think RIA Services support for Windows Phone is very important, but it will not make it in our V1.0.
With that said, you can still enable a Windows Phone 7 application to communicate with a DomainService and here is how…
At PDC 09, we made a big change, where every DomainService is now a WCF Service. Windows Phone 7 has support for talking to a WCF Service and we can leverage that to our advantage and create a mobile application that talks to a domain service. Yes, you do not get the rich client experience RIA Services provides for Silverlight, but you still get all the benefits of the server richness in the V1 release.
Here is how you would do that:-
I am going to skip over the section on how to create a domain service. You can find that at @brada’s post about exposing data from entity framework. Next we are going to configure the domain service to expose a soap endpoint.
Now that you have have a DomainService configured, we are going to configure it to expose a soap endpoint. In the PDC preview bits this was exposed by default, but we have now scaled that back for various reason. In the RC release you would need to configure your DomainService to be exposed as a WCF Soap Endpoint. Here is how you would do that (assuming you have created a domain service already):-
5: <add name="soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
2: <sectionGroup name="system.serviceModel">
3: <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
Now that we have configured our DomainService to expose a SOAP endpoint, we can now write a Windows Phone application that talks to it.
1: public override string ToString()
3: return LastName+", "+FirstName +" Title: " +Title;
1: public void LoadEmployee()
3: ServiceReference1.DomainService1soapClient client = new ServiceReference1.DomainService1soapClient();
4: client.GetEmployeesCompleted += new EventHandler<ServiceReference1.GetEmployeesCompletedEventArgs>(client_GetEmployeesCompleted);
9: void client_GetEmployeesCompleted(object sender, ServiceReference1.GetEmployeesCompletedEventArgs e)
11: this.listBox1.ItemsSource = e.Result.RootResults;
There is a very good sample posted at our code gallery site, that explains how you can do CRUD operation with the SOAP endpoint of a DomainService. You can find it here.
The RIA Services team just released the RC version of the product. You can find all the installation instruction @ http://silverlight.net/RIAServices.
I am going to talk about the features have been added to this release and also introduce you to the RIA Services Toolkit.
You can download the RIA Services Toolkit here.
We have added some great features since the PDC 09 release. We have heard all the feedback and tried to address some of the important ones. The list is taken from Dinesh’s forum post. Trust me there have been a lot more additions than the one listed below. I will follow up with more posts or updated links for each feature.
INDEI Support:- Validation support based on Silverlight 4’s INotifyDataErrorInfo. This is a non-exception-based model and enables async validations more easily. It also helps display errors flagged by the server in the UI.
Spiffier DDS: filter/sort/group descriptors support binding; ICommand support for Load/SubmitChanges/RejectChanges
Server throttling: you can regulate the per request load on the server / DB by specifying maximum result limit on a query method using the QueryAttribute.ResultLimit property.
AuthorizationContext: Similar to ValidationContext, now you have more options for implementing custom authorization rules (e.g. entity-based authorization)
Endpoint configuration support: Following the “secure by default” principle, only binary endpoint will be exposed but we have made it really easy to add additional/different endpoints if you plan to use them.
OData endpoint: you can point PowerPivot to a DomainService OData endpoint and analyze data by calling the appropriate query method. This is the first step in lighting up OData with RIA Services.
Along with these features in the main product, we are also announcing the availability of new package called the RIA Services Toolkit
The WCF RIA Services Toolkit is a collection forward looking features made available outside the normal RIA Services release cycle. A product of the WCF RIA Services product team, the Toolkit adds new functionality quickly for developers and provides the community an efficient way to help shape product development by contributing ideas and bug reports.
The following functionality are available in this release of the Toolkit:
You can find the breaking changes document here.
There is quite a bit to play with here and we would love to hear your feedback. You can reach to us at http://forums.silverlight.net/forums/53.aspx
One of things that came up repeatedly in our API Reviews for RIA Services was the fact that, we were requesting the total server count of the resulting query by default for paging scenarios.
This basically meant that were executing two queries on the database:-
This was never an issue for most non-paging scenarios as the framework was optimized for it. Here is the flow in the previous releases:-
1: loadOp = ds.Load<Customer>(ds.GetCustomersQuery());
2: loadOp.Completed += new EventHandler(loadOp_Completed);
The count for this query would by 91 entities and the total entity count will also be 91 (No of customers in Northwind database).
In the latest RIA Services bits, we made a change where the count is not returned by default for paging scenarios.
Running a query like the one specified above will not have affect on the count and only one query will be executed on the server.
Now let’s modify the query to look like this and run it on the RC bits:-
loadOp = ds.Load<Customer>(ds.GetCustomersQuery().Take(10));
loadOp.Completed += new EventHandler(loadOp_Completed);
Now let’s look at the count returned from the server:-
As you can see the TotalEntityCount is –1.
So now the question arises is that how do i get the count when i add a take. All you need to do is to set the IncludeTotalCount property to true on the EntityQuery. Here is an example to do that:-
EntityQuery <Customer>loadCustomers = ds.GetCustomersQuery();
loadOp = ds.Load<Customer>(loadCustomers.Take(10));
Here are the results:-
DomainDataSource has been optimized to take this change into account and it will not request for count in non-paging scenarios. As soon as a page size is specified, DomainDataSource will set the IncludeTotalCount property on the EntityQuery for you. You can always override this behavior by subscribing to the LoadingData event on the DomainDataSource.
Server throttling is one the new features we introduced in our RC release. It lets you regulate the per request load on the server / DB by specifying maximum result limit on a query method using the QueryAttribute.ResultLimit property.
Here is how you can specify a result limit on a query method:-
2: public IQueryable<Customer> GetCustomers()
4: return this.ObjectContext.Customers;
The result limit query only applies to the top level entities, so the above query will result in returning 1000 top level entities. This limit will not apply to the included entities.
As you will notice, the ResultLimit will not be propagated to the client. Things get really interesting when you use DomainDataSource especially when you are using LoadSize and PageSize.
Keep the following in mind, if you are developing an application that happens to have a query limit and uses DomainDataSource on the client:-
Here is an example on how to specify LoadSize and PageSize on DomainDataSource