![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Using DataContext with WCF services Hello, I'm creating a WCF service in which I use LINQ to SQL to do all my data access. I have a couple of architectural questions about using LINQ to SQL from WCF services: 1) What is the right way to use DataContext in this scenario? The service will obviously be used by multiple clients simultaneously. Should I be creating a "global" DataContext object that I use from within each of my WCF operations, or should I create a DataContext within each operation? My guess is that a global DataContext object is the right approach, but in this case, how would I ensure that when I call SubmitChanges it only submits the changes requested by a specific client? 2) What is the right way to pass data to/from WCF operations? Is it possible to return the entity classes from an operation? If it isn't (which I'm guessing is true), then how do I use LINQ to SQL's conflict detection and resolution? If my DataContext object is local to each operation, would it be able to detect conflicts at all? Thanks, -- Ragesh Krishna. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Using DataContext with WCF services > Should I be creating a "global" DataContext object that I use from Quote: > within each of my WCF operations, or should I create a DataContext > within each operation? thread safety. Quote: > 2) What is the right way to pass data to/from WCF operations? > Is it possible to return the entity classes from an operation? One common approach here is to keep both the original and new version (at the client) - send them both up the wire and use the overload that allows you to add them to the data-context; this enables change/conflict detection. Alternatively, look at ADO.NET Data Services (aka Astoria), which does all this for you - i.e. it provides a client data-context that can talk to your IQueryable<T> service over WCF. Marc |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| WPF - Binding IsEnabled property doesnt evaluate until DataContext | .NET General | |||