Archive | WCF RIA Services RSS feed for this section

Slides fra talk om WCF RIA Services hos Dansk IT

1 Dec

Jeg afholdte i formiddags en 3-timers talk om WCF RIA Services hos Dansk IT. Der var en virkelig god dialog og der kom nogle gode (og afklarende) spørgsmål.

Slides og demoer (inklusive custom validation) kan downloades her:

by xamlgeek

Use DomainServices as Service References

30 Nov

DomainServices was introduces as part of WCF RIA Services. WCF RIA Services offers a solution on how we can build a middle-tier having clients and servers.

Using a DomainService in a Silverlight client is very easy using WCF RIA Services – the WCF RIA Services link between the client and the server will automatically generate the client side code that we need to communicate with the server.


To avoid writing middle-tier functionality more than once we want to be able to reuse the DomainService and the logic inside of it to all of our projects. Most project types beside Silverlight do not understand WCF RIA Services yet. But as a DomainService ultimately just is a WCF Service we can just make a normal Service Reference (or ChannelFactory) to it and reuse the logic.

For that to work you need to make a few adjustments to the project hosting the service. When you add a DomainService to your project a DomainServiceHttpModule http module is added to your web.config and ASP.NET compatibility is turned on.


The DomainServiceHttpModule dynamically generates a WCF Service based on our DomainService. In this sample I have added a DomainService called DomainService1 in the root of my ASP.NET web project called WebApplication1. The web project is using port 6479. Based on this information I can point to my dynamically generated WCF Service from my browser:



If I try to make a Service Reference to the WCF Service I will get an error:

There was no endpoint listening at http://localhost:6479/Services/WebApplication1-DomainService1.svc that could accept the message.

Before I can make a Service Reference to the service I need to define an endpoint in the web.config. First I need to add a custom configuration section for DomainServices within System.ServiceModel.


Using the RIA Services Toolkit I can now define a SOAP endpoint (I need to add a reference to Microsoft.ServiceModel.DomainServices.Hosting found in the Microsoft SDKs/RIA Services/v1.0/Toolkit/Libraries folder).


Finally I can add a Service Reference to the service and use it as if it was a regular WCF Service.



You can download the full sample from

by xamlgeek

Execute Stored Procedure in WCF RIA Services

5 May

WCF RIA Services amazing! I use it in a several Silverlight projects and keep getting amazed.

Today I got a question about retrieving data from a Stored Procedure in Silverlight using WCF RIA Services and a LINQ-to-SQL datamodel.

The LINQ-to-SQL datamodel in this sample contains a table called Book and a stored procedure called GetBooks. The stored procedure returns a list of books from the Book table and it is attached to the datamodel.


I have created a domain service that use the datamodel to return data to the Silverlight client. In the service I have created a method called GetBooks – it returns an ObservableCollection of Books.


The stored procedure return an ISingleResult of GetBooksResult. I have tried to convert the result to an ObservableCollection without success (any ideas?). To fix this issue I loop the result and add the items to a new ObservableCollection.

Finally, on the Silverlight I call my domain service (_context) and invoke the GetBooksQuery method to get the result.


I got inspiration from this blog post by Scott Gu.

by xamlgeek

Properties in WCF RIA Services – using LINQ-to-SQL

28 Feb

I have previously written a post about including properties in WCF RIA Services. The post was using POCO as business model. If you use LINQ-to-SQL as your business model you might need some extra load options to get your associated properties sent from the server to the client.

You can add the extra load options in the domain service methods on the server. In my previous post I use two entities; a Company and an Employee entity. The Company entity has a Employee property called CEO.

First you need to add a reference to System.Data.Linq and add a using in the BusinessService.


Second you need to add the load options. In this case you want CEO to be loaded when the Company is loaded.


Finally you set the load options to the DataContext and then you’re ready to return your data as normal.


(In the code above I get an error on the DataContext; don’t mind that – it’s just because I used the sample code from the previous post that don’t use LINQ-to-SQL and there don’t recognize the DataContext object.)

by xamlgeek

Include related properties in WCF RIA Services

21 Feb

WCF RIA Services provide lots of possibilities on getting data from the server to the client whether it is a Silverlight client or a console application.

One of the challenges that you may experience using WCF RIA Services is getting related properties to an entity to be included on the client. But no need to get scared – it is actually pretty easy.

First of all you need to create an association between your entity and the related entity. Lets say we have a company (Company) with a CEO (Employee):



When we get a list of companies from the client we would like to have the CEO property included and filled on the company. To do that we need to add a few attributes to the CEO property. Instead of adding the attributes on the entity object we can create a metadata file that holds this type of information.


Now the CEO property will be included, filled and ready to use when we call a query from the client that returns a list of companies.

You can download sample from my DropBox:

by xamlgeek

Talk about RIA Services

18 Nov

This afternoon I did a talk about .NET RIA Services and about building data-driven applications with ASP.NET and Silverlight.

You can get the slides and demos here:

At the same time on the other side of the world, the keynote on day 2 at PDC09 was taking place. At the keynote Scott Guthrie presented Silverlight 4 beta including WCF RIA Services beta.

WCF RIA Services does not require Silverlight 4 beta – it is targeted Silverlight 3 development.

You can read a lot more about WCF RIA Services here where you also can get the bits, watch videos, get samples and of course get the documentation.

I’m really looking forward to get into the details of the WCF RIA Services beta (and of course of Silverlight 4 beta) – and I will keep you posted ;)

by xamlgeek

Silverlight, Prism & .NET RIA Services

13 Nov

In these days I’m working on a project for a Danish media company. The project is pilot showing the possibilities with the FAST search engine. On top of the FAST search engine we are building a Silverlight client showing the result. From here the user and dive deeper into the results or work with results.

To make the Silverlight client as modular and flexible as possible I have used PRISM to split the content into modules and the eventaggregator inside PRISM to make the modules disconnected from eachother and selfcontained.

I have implemented .NET RIA Services as middle tier to transfer the search result from the FAST search engine to the Silverlight client. Even though .NET RIA Services works great and seems really stable, there are some bugs and missing features. I’m looking forward to the official beta of .NET RIA Services next week :)

All-in-all I was a bit exited about this setup and if it worked. Even though I’m not through with the project, the technologies seems to work great together. I’m not sure that I can post deeper technical stuff about this project, but maybe some fragments will be available.

Next week (18th December 2009) I’m hosting a talk about .NET RIA Services – more about that here.

by xamlgeek

.NET RIA Services roadmap

18 Oct

Dette roadmap er et udpluk fra en post fra Tim Heuer.

  • July 2009: Updated CTP
  • PDC 2009: Beta
  • First part of 2010: RTW

Lige nu arbejder jeg på et par projekter, der anvender juli CTP’et og sidder med en lidt “udfordringer”. Allerede nu er der go-live licens på CTP’en, men det er ikke alle dele Microsoft anbefaler, der kan anvendes i produktion.

Den 18. november 2009 afholder TENTEO et gå-hjem-møde om .NET RIA Services. Der bliver taget udgangspunkt i betaen.

by xamlgeek

Gå-hjem-møde: .NET RIA Services

9 Oct

Mange har hørt om det, færre har læst om det og endnu færre har prøvet det. .NET RIA Services er nyeste tiltag indenfor RIA udvikling fra Microsoft. .NET RIA Services er først og fremmest et sæt guidelines til at designe og bygge RIA applikationer. Derudover er det et sæt .NET biblioteker og Visual Studio templates, der gør det nemt at implementere de guidelines.

TENTEO afholder den 18. november 2009 kl. 16:00-18:00 et gå-hjem-møde for udviklere, som vil se og høre om mulighederne i .NET RIA Services.

På gå-hjem-mødet ser vi på mulighederne for at anvende .NET RIA Services i Line-Of-Business applikationer og ser på nogle praktiske eksempler. Vi tager udgangspunkt i Silverlight og ASP.NET som front-end teknologier, men ser også på, hvordan .NET RIA Services kan anvendes i andre teknologier.

Læs mere og tilmeld:

.NET RIA Services

7 Oct

Mange har hørt om det, færre har læst om det og endnu færre har prøvet det. .NET RIA Services er nyeste tiltag indenfor RIA udvikling fra Microsoft, der understøtter udvikleres sande natur – at være så doven som muligt.

Building Data-driven Applications with Microsoft ASP.NET and Silverlight

Jeg sidder nu på vej hjem fra JAOO konferencen, hvor Thomas Juul og jeg var blevet spurgt om at holde en tutorial om “Building Data-driven Applications with Microsoft ASP.NET and Silverlight”. Egentlig var det Nikhil Kothari, der skulle have holdt tutorialen, men han var desværre blevet forhindret. Tutorialen gik ganske udemærket og vi fik nogle gode tilbagemeldinger.

I ugerne op til tutorialen sætte mig virkelig grundig ind i .NET RIA Services eftersom det var dét, der var tutorialens omdrejningspunkt. Jeg blev virkelig positivt overrasket over, hvor godt et produkt .NET RIA Services allerede er. Det ligger stadig i CTP og kommer først i beta til PDC, men der er go-live licens til det. Selvfølgelig indeholder det stadig nogle bugs og uhensigtsmæssigheder, men i bund og grund er det et fint produkt. Personligt ville jeg dog nok være lidt tilbageholden med at anvende det i et produktionsmiljø, før det har modnet lidt mere.

Hvad er .NET RIA Services?

Nu sidder der måske nogle og spørger: “Hvad er .NET RIA Services overhovedet?”. .NET RIA Services er først og fremmest et sæt guidelines til at designe og bygge RIA applikationer. Derudover er det et sæt .NET biblioteker og Visual Studio templates, der gør det nemt at implementere de guidelines.

Baggrunden for overhovedet at lave disse guidelines bunder i et ønske om at gøre det nemmere for udviklere at lave RIA applikationer. Det er ikke nogen hemlighed, at udvikling af skalerbare, datadrevne LOB RIA’s til tider kan være en udfordring. Endvidere er der mange udviklere, der har det svært ved at udvikle til en klient via den asynkrone model, der er helt grundlæggende for Silverlight.

Med .NET RIA Services bliver det muligt at komme udover nogle af de udfodringer og Microsoft har forsægt at skabe en kommunikationsmodel mellem server og klient, som var det én applikation, dog uden at tabe de fordele der ligger i en n-tier applikation.


Når .NET RIA Services kommer i beta til PDC, kommer vi formodentlig til at høre meget mere om det. Indtil da vil jeg anbefale alle Silverlight udviklere at downloade .NET RIA Services og tage en nærmere kig på det:

Og mon ikke at der falder en post eller to af snart om, hvordan du så kommer igang med at bruge det…

by thomas martinsen