views:

45

answers:

1

I'm building a Silverlight app that I want to be hosted in Azure and use Azure table storage.

I have a class that represents the main data entity, ExpenseInfo. It has many data annotations for RIA validation, such as [Required].

I am following this tutorial to set up the REST service for access from SL. It wants there to be a class in my web role for data serialization. This class would contain all the same data as ExpenseInfo.

So, where do I want ExpenseInfo to be? Do I want separate classes in each project? Put it in one project, and instantiate it in both? Is it weird to have a class with all those data annotations in the server side web role?

Thanks, I'm new to SL and Azure.

A: 

The pattern you're looking for here is the Data Transfer Object (DTO) pattern. Here's a good article on the pros and cons of that pattern. Personally, I don't mind the additional classes that a DTO and/or and Adapter pattern brings (you will see adapter type patterns used all over the place, MVVM is a hot one right now). I have a strong dislike for sharing business logic in assemblies across a trust boundary, so I generally use DTO/Adapter in my architectures.

JP Alioto
I think I'm looking for something a bit more basic. Where do I put the class in VS's solution? The Silverlight project, or the web role project?
Rosarch