0
votes

I have an issue very similar to this one.

There is an existing software (Data & business layer) running on a server and I want to add a Silverlight GUI client to it. Communication works through WCF services at the moment, but I would like to use WCF RIA services instead.

My architecture looks like this:

Database - DAL - BL - WCF Services - Silverlight client

All business logic is on the server, the Silverlight client is mostly a data viewer.

Questions:

1) Would it make sense to replace the WCF Service (used for communication between client and server) with a WCF RIA Service?

2) Is it possible to have the WCF Service talk to a WCF RIA Service? Like this:

Database - DAL - BL - WCF Services - WCF RIA Service - Silverlight client

or

Database - DAL - BL - WCF Services - Translator - WCF RIA Service - Silverlight client

or

Database - DAL - BL - WCF RIA Service - Silverlight client

All the examples and tutorials for RIA services seem to use them to directly access a database, but what if I want to access a business layer instead? How would I represent the "data objects" on the business layer? And how would I call functions on the server from the client using a RIA service, e.g. to calculate something?

1
Do you have the ability to modify the objects used by the WCF services? You may need to add/change/remove attributes to satisfy WCF RIA. Also, is the Silverlight client exclusively read-only?Ed Chapel
The objects are administrated by another team, who would have to do the changes, but it would be possible. The client is not read-only, there will be small operations like "send an int to the server".Phasma

1 Answers

2
votes

1) I would lean heavily towards using WCF RIA for all the benefit you get with the tooling keeping your Silverlight code up to date. Using Service References increases the odds that the WCF services and Silverlight implementation get out of sync.

2) I would wrap the WCF Services with WCF RIA Services as in example #1:

Database - DAL - BL - WCF Services - WCF RIA Service - Silverlight client

Your WCF RIA DomainService should take an instance of the WCF service and merely wrap it.

[EnableClientAccess]
public class FooDomainService : DomainService
{
    FooWcfService _fooWcfService;

    public FooDomainService(FooWcfService fooWcfService)
    {
        _fooWcfService = fooWcfService;
    }

    public IQueryable<Bar> GetBars()
    {
        return _fooWcfService.GetBars().AsQueryable();
    }
}