Using two versions of a dll at the same time in LinqPad
I have several SQL databases using a 'Typed data context from my own assembly'. But I have one database which for various reasons I don't to upgrade to the latest schema version. Hence I want to access this using the older version of the dll. (Same filename, but different version).
If I open LinqPad and try to access the old database using the old dll in one query and try to access one of the new databases using the new dll in another query, am I likely to run into trouble?
The dll isn't strong named nor installed in GAC if that makes any difference.
If I open LinqPad and try to access the old database using the old dll in one query and try to access one of the new databases using the new dll in another query, am I likely to run into trouble?
The dll isn't strong named nor installed in GAC if that makes any difference.
Comments
Presumably the typed datacontext with the older DLL is in a different folder? If so, you'll need to create a different connection that points to that folder. To make it easier to identify which connection you're dealing with, you can rename connections using the option on the context menu.
Probably didn't explain myself very well.
I understand that when I execute my query it runs in a different appdomain and hence is ok, but I was concerned about what happens beforehand, eg whilst writing the query. LinqPad must be accessing the typed datacontext dll for the intellisense to work. Even just expanding the connection must load the dll to build the list of classes/tables. Hence it would look like LinqPad would need to be accessing both dlls at the same stage.
Is this part safe?
If you have two versions of an assembly in two different folders, LINQPad will load whichever assembly is in the folder that you point it to.
Have I missed something?
string dir1 = ..
string dir2 = ..
string dll = ..
var a = Assembly.LoadFrom(Path.Combine(dir1 , dll));
var b = Assembly.LoadFrom(Path.Combine(dir2 , dll));
then, even through I am trying to load two different assemblies from two different folders, it will not work.
If LinqPad created a new app domain every time you expanded a connection, then I can see how it would work, but it only appears to create a new app domain when I execute a query.
Got to say, it appears to work, but I don't understand how and I don't like things I don't understand.
Sorry to be a pain.
http://www.linqpad.net/DataContextDrivers.docx
See "Application Domains & Loading Assemblies"
I'll read through the document later (when I have a clear head).
Thanks again for your help.