Based off of this question, and the associated answer, I'd suggest trying to handle the AssemblyResolve
event, so something like this:
//in your startup method
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);
//...
private static Assembly MyResolveEventHandler(object sender, ResolveEventArgs args)
{
//not sure if this will be what the name is, you'd have to play with it
if (args.Name == "EntLibContrib.Data.OdpNet.OracleDatabase")
{
return typeof(EntLibContrib.Data.OdpNet.OracleDataReaderWrapper).Assembly;
}
//not sure if this is best practice or not (to return null if truly unknown)
return null;
}
That answer does suggest your current solution as the preferred method, but I agree that it does feel hacky. Not sure if this other method will feel any less hacky to you; it does to me in that at least this way you can clearly document this event handler instead of having a bogus variable somewhere with comments like //DON'T REMOVE, VERY IMPORTANT!!!