views:

22

answers:

2

hi,

I have an asp.net web app which holds its data in an sql server 08 r2 db.

I have a silverlight admin interface on the same web app, and I will have a win forms app which will need to add/retrieve data from the sql db. Is there a way I can use linq in both clients?

I mean something like linq2twitter, where in the silverlight or in winforms app I can use linq to query and update the data.

Currently Im thinking of just using web services, but the data objects are complicated and they're connected to so many other data objects, it would be very convenient to work with them in linq, especially because the asp.net app itself uses a linq data context for its operations. Is there a way to expose this context over http or something?

Thanks

A: 

I think you probably want to look at WCF Data Services - which does pretty much exactly what you suggest i.e. it exposes a data context via web services (see also OData) and provides tools to consume and work with same via Linq

Murph
hmm sounds awesome, but Im thinking now whether should use wcf services over asmx and just upgrade my win forms program to .net 4 (I might be able to afford it since its an in house app) How difficult/easy would it be to make the move (asmx->wcf) ??
giddy
A: 

hey,

I tried WCF Data Services, its freaking amazing but it was a little hard to get up to speed with it, and difficult to diagnose what went wrong where, just for anyone else in my position here is what I did:

  1. I watched this really fun scott hanselman video on OData
  2. Landed on this msdn page after 1 hour of meandering. (Note all the snags like loading related entities, also, there is a list of unsupported linq operations on wcf ds)
  3. Went crazy looking for some examples.
  4. Tried my own stuff with lots of problems--> Got fiddler and then fixed all of them =)

Hope that helps!

giddy