Q:

Dynamically connect to any Service Reference

This is a WCF project. The idea is to use this WCF Service as a "go-between" between my ASP.NET site and SharePoint. This way I avoid CAML in the ASP.NET site and it keeps all of the code that accesses SharePoint encapsulated inside the WCF Service. Ideally I would like this WCF service to be a .NET 4.0 project but I'm not sure if that is possible at this stage either, however if I don't directly connect to the SharePoint Object model and use OpenWeb then I think I should be OK? Any feedback on this would be great too.
I have a situation where I want to "dynamically connect" to one of any Service References in my WCF Service code. The Service References are connecting to the _vti_bin/ListData.svc that all have identical structures (A, B and C as shown below...) so all Lists and Columns are all named the very same across multiple Site collections. The structure is like this.
Root Level Site
 1. ASite
 2. BSite
 3. CSite
 4. ...and more to follow.
1-4... are all Site Collections using their own Content Databases.
I have manually created the Service References and then I write the code as show below to connect in to do what I need to do with the Lists etc. 
My dilemma is that I dont know how to dynamically connect to any given Reference rather than writting code for each Reference. Because each reference has it's own named DataContext I dont even know if this is possible.
FYI the spSite string is something like http://sps.mysite.com/sites/asite/_vti_bin/ListData.svc
and
http://sps.mysite.com/sites/bsite/_vti_bin/ListData.svc
....
var serviceReferenceASite =
                new ServiceReferenceASite.ASiteDataContext(
                    new Uri(spSite)) { Credentials = Utilities.GetCredentials() };

IEnumerable<ServiceReferenceASite.JobNumbersItem> jobList =
                  from jobNumbers in serviceReferenceASite.JobNumbers
                 where !jobNumbers.JobStatus.Title.Contains("Job Complete")
               orderby jobNumbers.JobNumber
                select jobNumbers;

var serviceReferenceBSite =
                new ServiceReferenceBSite.BSiteDataContext(
                    new Uri(spSite)) { Credentials = Utilities.GetCredentials() };

IEnumerable<ServiceReferenceBSite.JobNumbersItem> jobList =
                  from jobNumbers in serviceReferenceBSite.JobNumbers
                 where !jobNumbers.JobStatus.Title.Contains("Job Complete")
               orderby jobNumbers.JobNumber
                select jobNumbers;

FYI. This project is using .NET 3.5 because I have a hook into the SharePoint Object Model! I would like to think that I can remove that hook and then use the .NET 4.0 framework so I could potentially us the dynamic datatype in a method that will return the correct Reference given the URI that is to be qureied by the ASP.NET site.
Hope this sounds clear enough and I hope someone out there is much smarter than me and knows how I can dynamically create any Service Reference-Reference without having to copy and paste my code a million times for each Service Reference I have.

Thanks James, for your input. I finally had time to prove my theory and it worked great. 

A:

A service reference in an ASP.NET project is just a collection of proxy classes for talking to that service. The URL is set up during the creation of the service reference pretty much for getting metadata in the first place but also doing updates to the reference to get the latest metadata and to rebuild the proxy if needed.
The URL required to talk can be set at runtime, like how these guys discuss: https://stackoverflow.com/questions/5036308/dynamically-switch-wcf-web-service-reference-url-path-through-config-file
Now the thing to remember in SharePoint is that the URL under which the services are referenced (under /_vti_bin) determine the context for the service call.
So if you are in a specific website, and you want to call a web service to get data from a website called 'siteA', for example, you'd need to set the URI for the service to http://myweb/sites/siteA/_vti_bin/ListData.svc
How you decide how to tell your proxy service how to build the URI for the calling service is entirely up to you. You might need to pass in another parameter into your web service call.
I'd watch out for user impersonation though. I know that passing credentials from one server to another causes issues and you'd need to have Kerberos enabled (double-hop issue). Unfortunately this stretches beyond my immediate knowledge and have no idea how this is handled in code, but it's something to watch out for.

