Consider you have 2 classes: Student and Course and a Course can be added to the student through a method on the Student.
class Course{ public string Name;}
class Student {
public string Name;
private List<Course> courses = new List<Course>();
public ReadOnlyCollection<Course> Courses {get {return courses.AsReadOnly();}}
public Add(Course course) { if (courses.Count <= 3) courses.Add(course);}
}
The above would be the business entities on the server and the Add method could have even more business logic built into it.
Now when the business entity is required to be displayed in a Silverlight client, I would have to create a web-service that would expose a method that could send down the Student object to the client.
My question is: do I need to replicate the business logic on the entities that the Silverlight client will end up using? Or is there an easier way to do this through some other technology/sdk/toolkit? Or is it possible to reuse the above business entity in the Silverlight client? in which case is there an easy way to copy the data from the web-service proxy object onto the business entity?
Check out RIA Services. It enables you to have shared logic between the server and the client business objects (you write the code for the server, and it automatically code generates the logic in the client side objects). Alternatively, if you don't want to use RIA Services, try this method I wrote about in the pre RIA Services days: http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-3.aspx
Hope this helps...
Chris Anderson