Reputation: 25686
I just started learning Silverlight, and I'm wondering about the typical architecture of a Silverlight application and the workflow in the application (I'm using Silverlight 2, but will move to 3 any time soon).
In my test-application I currently only have the two default projects - MyProject and MyProject.Web. I'm familiar with the MVVM pattern, and have organized my code using this. However, I'm having trouble understanding what goes on the client and what goes on the server - and how do I define this? I'd guess the ViewModel layer is on the client - communicating with the Model layer being on the server. But how will they communicate? Using WCF? Should the server part of my application be defined in a separate project? And should the client part have a reference to this?
I ran into problems when I wanted to set my Model to communicate with a SQL Server using LINQ to SQL. "LINQ to SQL" items doesn't seem to be allowed in Silverlight projects, and if I add this to a separate Class Library Project I'm unable to reference this project from my Silverlight project as; "You can only add project references to other Silverlight projects in the solution".
Any information that might enlighten my understanding of the architecture and workflow is greatly appreciated. Thx.
Upvotes: 3
Views: 1344
Reputation: 62387
Windows Communication Foundation (WCF) is the way Silverlight communicates to the server. You can also look at the RIA framework currently in tech preview, which adds a layer between Silverlight clients and WCF web services for data validation, allowing the sharing of validation code (among other things).
Direct connections to databases are not possible from Silverlight - instead you need to use a WCF service via a web server to access your data. If you use old style ASP.NET web services, Silverlight wraps these for you into WCF-like wrappers when referencing those services.
Upvotes: 2