views:

405

answers:

1

Hello Everyone,

I have an XBap system designed as a 3-layer application. The XBap client consumes the logic through a WCF Service using netTcpBinding.

For easy of databinding and to be able to re use data validation built-in my business objects, I choosed to reference the business objects library from the xBap client instead of generating proxies.

These objects implement no logic other than they own basic data validation. The real business logic is implemented inside my WCF service.

Now I'm facing a big challenge. I need to port the xBap to silverlight, so I need my silverlight app. to consume the same business logic (which is also used by a winforms LOB application).

Some problems that arise:

1) Can't reference the business objects library from the silverlight client application because it's compiled as a regular dll and not a silverlight one.

2) Can't compile it as a silverlight library because I'd loose lots of functionallity and obviously is not a good idea anyway. If in the future a new .net platform arises I have no warranties that the modified (silverlight) dll will work.

I had some hope when I discovered RIAServices. I read somewhere I could implement a service and use any kind of DAL. (I have a custom one) but I found no example showing how to put RIAServices on top of an existing business layer. It's worth to say that we don't use (and we are not planning to) LINQ. Every example I found started using RIAServices and writing the business logic from scratch using LINQ.

RIAServices generates databinding-ready client code, but I feel I would have to change the entire business layer and that would be really expensive.

So, the solution seems to be to keep using WCF, specially now that silverlight 3.0 supports a new binary binding, and to work with proxies instead of the actual business objects. The problem is that those proxies don't include data validation, property change notification and change tracking, three aspects that my business clasess perform.

RIAServices resolves these and other aspects but it requieres to work with silverlight proyects. WCF (SVCUtil.exe) generates proxies but they are not 'complete' for our needs. So It seems I'll have to develop my own utility for generating those proxies taking a business object as input.

Before I start doing so, I wish to know if anyone has already faced this problem and was able to resolve it in a convinient and painless way.

Thanks in advance,

Gonzalo

+1  A: 

Check this blog post and sample - Business Apps Example for Silverlight 3 RTM and .NET RIA Services July Update: Part 8: WCF Based Data Source.

It shows writing a DomainService using .NET RIA Services that exposes operations and a model to Silverlight client, and in turn works against a WCF service.

You shouldn't need to change your business logic. The DomainService as a layer would reuse that, and it would make sense if you can't expose your business logic/WCF services as-is to Silverlight clients ...

Hope that helps.

NikhilK
Thanks a lot NikhilK.May be the your link helps me figure how to put RIAServices on top of my business Logic.Regards,Gonzalo