I have found the cause, but not the reason for the behaviour.

All data access code in my solution has been isolated to run an AppDomain
and is only seen through an interface and some shared classes. I like the
way this abstracts away features and it means the main app does not need
any references to the heavyweight libraries used for database work. When I
create the AppDomain I do it like this:

string datafolder = (a subfolder);
string libraryFilename = (the entry point dll);
string configFilename = (the config file in the subfolder);
var setup = new AppDomainSetup()
{
    ConfigurationFile = configFilename,
    ApplicationBase = datafolder
};
domain = AppDomain.CreateDomain("Data Domain", null, setup);
dataProxy = (IDataCore)domain.CreateInstanceFromAndUnwrap(... , ...);
You can see that I specify the config file to be used by the AppDomain, and
I know it's being used as it has config stuff for Entity Framework and
other things.

I created some tiny experimental apps and xcopied them over to the test
machine. This showed me that Entity Framework 5 was working, but as soon as
I added SQLite it died. Although I specify the SQLite factory in the
AppDomain's config file it wasn't being used. I put the same config lines
the main App's config file and it works.

So I'm not sure who's to blame for this. Is SQLite not obeying the rules of
locating config files? Am I missing some extra obscure configuration
tricks? Have I outsmarted myself by using AppDomains? Who knows! At least I
have a workaround.

Greg K

Reply via email to