Multiple DataContext Objects and Cross-Queries

A co-worker of mine was using LINQ to SQL and trying to write a query that connected across multiple data context objects connecting to different databases.  However, this was an issue because LINQ doesn't allow this to happen.  The LINQ object "knows" that it is part of a different data context, and a detailed message specifies that this isn't allowed to happen.  So, what is the solution?  One of the things we did was to pull back the first data source in a query, and call the ToList() option.  We were pulling back one field anyway, so the ToList() option was a good option to separate the single value from the data context.

Published Saturday, February 09, 2008 6:05 AM by bmains
Filed under:

Comments

# re: Multiple DataContext Objects and Cross-Queries

Sunday, February 10, 2008 8:57 PM by b l

Good thinking Brian. :)