views:

115

answers:

3

I am starting a new Silverlight 3 project in Visual Studio 2010. My plan is to have a project for each of these:

The Silverlight application
The hosting web application
The WCF service

This last one will also contain a typed dataset (that will serve as my data logic layer) and a few classes to do my business logic. The WCF service methods will return typed data to Silverlight.

I am just wondering if there is any compelling reason to split the BLL components out of the WCF service project. Any other comments about organizing the project are welcome, too, of course. One thing I will not entertain is using some ORM like N-Hibernate. The entire solution needs to be constructed with the more-than-capable tools that come with Visual Studio. Thank you!

+1  A: 

The project I work on at work has separate projects for the business components. I really think it depends on the size of the project. It might make sense in a large project to do this, especially if multiple parts of your project would be sharing the same BLL.

Aaron M
I see what you are saying. If I have business logic that the client app needs (and that the data layer doesn't), for instance, then those might be good candidates for placing into a separate project / library. I could reuse those for sure. I can reference a Silverlight class library from outside of Silverlight so that works fine. Thanks.
Wade
A: 

Have you considered WCF RIA Services? It's not a direct answer to your question but if you do, it'll change the question.

serialhobbyist
It is my understanding that Visual Studio 2010 and Silverlight 3 do not support RIA Services. At least, I see no mention of them anywhere when trying to Add Item... in 2010. Also, RIA is only in beta, right? I don't want to use beta software for production. And it may take a long time for MS to bring it out of beta.
Wade
Fairy Nuff. It is only in beta (but with a go live licence). There is a download for 2010 but maybe it's for SL4.
serialhobbyist
A: 

You definitely need to have the Silverlight app in a separate project.

As for extracting BLL classes out of the WCF services project into a separate one, this depends only on the nature of the application, chosen architecture and future foreseen extensibility. Is far as I know, in Silverlight 3 you cannot have shared DLLs for Silverlight and other types of projects. So extracting the BLL classes in their own project would not do you any good in this sense.

Usually I extract classes in separate projects when

  • either, I use the DLL in multiple other projects
  • or, I want to make sure some classes do not make use of other, so I isolate them by moving them into a project

So, in the end, I cannot say that there is any compelling reason for having multiple projects.

... just my thoughts. Hope they help.

Ciprian Bortos
Here's what I've gone with: 1.Silverlight web project to host the app and the WCF services; 2.Silverlight project with service reference to 2; 3. BO project with classes referenced by 1; Project 2 gets all class def info from the WCF reference(s). My new challenge is how to implement data caching in 2 (local storage) w/o putting all of the code into the MainPage code-behind. This is starting to look like the only way, though, b/c the callbacks to WCF are async and I can't fig out how to do that in a client-side helper class.
Wade