views:

1093

answers:

4

What's the best Data Access Layer strategy for Silverlight 2 and 3 apps?

+3  A: 

Since you're running in a browser, you shouldn't be doing any DataAccess from the client side. The client typically calls a web service or wcf service, and that service has plenty of freedom in choosing how to do data access.

David B
Couldn't agree more.
Jeff Yates
Um... Calling the service is Data Access.
Chris Pietschmann
@Chris Pietschmann, No, it is not.
David B
Technically you are accessing data, so it really is Data Access. You just aren't connecting directly to a sql database from Silverlight. Instead you are creating a service that Silverlight talks to, and essentially, from the point of view of your Silverlight Client App, your Web Service is a database (something that stores data).
Chris Pietschmann
A: 

For every Silverlight application I've worked on that has needed data access, I've used Web Services (written in WCF). All of my business and data access logic are enforced in those services...leaving Silverlight to do what it does best, the interface!

You might also want to check out ADO.NET Data Services. From what I heard around MIX09, there should be some cool stuff coming out of there.

Justin Niessner
+3  A: 

If you're using Silverlight 3 you could look into .NET RIA Services, which creates a DAL wrapper and provides easy access to the methods client side. The DAL itself, depending on how you define that term, can be EF, Linq2SQL, POCO etc.

jbloomer
I second this - .NET RIA Services makes a great DAL for Silverlight 3 apps.
James Cadd
A: 

If you are within the same domain and you are careful about security, you could use the ADO.NET entity data services. Here are some resources

http://www.microsoft.com/uk/msdn/screencasts/screencast/308/adonet-data-services-a-basic-silverlight-client.aspx

http://msdn.microsoft.com/en-us/library/cc838234(VS.95).aspx

Jacob Adams