I have an ASP.NET 3.5 e-commerce site that has an admin section. I want to swap out the ASP.NET-based admin section and rewrite it in Silverlight 2. Silverlight requires async calls, so I can’t just call my existing DAL from a new SL2 app.
What is the best practice for doing something like this? Should I create a WCF service and call my existing DAL through that, or should I port everything to WCF, or should I just add async calls into my existing, non-WCF DAL. Looking for advice on the best way to do something like this.
EDIT: So what I’m reading is that the best way to do this is to leverage my existing DAL and create a simple WCF service that references that DAL and wraps the calls. The WCF service does nothing more than act as a middleman to get to my DAL, but expose it to Silverlight. What if you’re starting from scratch? Should you build out your DAL as a WCF service to begin with and use that service from a WPF client, ASP.NET client, Silverlight client, any other consumer, etc.
You generally want to avoid putting data access code into a Silverlight application, because the user can easily reverse-engineer your code. In fact, the Silverlight runtime does not include any database communication framework classes for this very reason.
The recommended best practice is to wrap your Data Access Layer with a WCF service and call the WCF service from Silverlight. There’s a good article on doing this here.