private static string GetEfPath(IConnectionInfo cxInfo, bool convertFullNameToGacPath) { string efVersion; string customAssemblyPath = cxInfo.CustomTypeInfo.CustomAssemblyPath; if (string.IsNullOrEmpty(customAssemblyPath)) { return(null); } try { string path = Path.Combine(Path.GetDirectoryName(customAssemblyPath), "EntityFramework.dll"); if (File.Exists(path)) { return(path); } } catch (ArgumentException) { } if (customAssemblyPath == _lastEfPathInput) { return(convertFullNameToGacPath ? _lastEfPathGac : _lastEfPath); } _lastEfPath = null; string shortName = Path.GetFileNameWithoutExtension(customAssemblyPath); Assembly customAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault <Assembly>(a => a.GetName().Name.Equals(shortName, StringComparison.InvariantCultureIgnoreCase)); if (customAssembly != null) { efVersion = new EFVersionProber().GetEfVersion(customAssembly); } else { using (DomainIsolator isolator = new DomainIsolator("Probe EF version")) { efVersion = isolator.GetInstance <EFVersionProber>().GetEfVersion(customAssemblyPath); } } _lastEfPath = efVersion; string str5 = _lastEfPathGac = GacResolver.FindPath(efVersion); _lastEfPathInput = customAssemblyPath; return(convertFullNameToGacPath ? str5 : efVersion); }
private static string GetEfPath(IConnectionInfo cxInfo, bool convertFullNameToGacPath) { string efVersion; string customAssemblyPath = cxInfo.CustomTypeInfo.CustomAssemblyPath; if (string.IsNullOrEmpty(customAssemblyPath)) { return null; } try { string path = Path.Combine(Path.GetDirectoryName(customAssemblyPath), "EntityFramework.dll"); if (File.Exists(path)) { return path; } } catch (ArgumentException) { } if (customAssemblyPath == _lastEfPathInput) { return (convertFullNameToGacPath ? _lastEfPathGac : _lastEfPath); } _lastEfPath = null; string shortName = Path.GetFileNameWithoutExtension(customAssemblyPath); Assembly customAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault<Assembly>(a => a.GetName().Name.Equals(shortName, StringComparison.InvariantCultureIgnoreCase)); if (customAssembly != null) { efVersion = new EFVersionProber().GetEfVersion(customAssembly); } else { using (DomainIsolator isolator = new DomainIsolator("Probe EF version")) { efVersion = isolator.GetInstance<EFVersionProber>().GetEfVersion(customAssemblyPath); } } _lastEfPath = efVersion; string str5 = _lastEfPathGac = GacResolver.FindPath(efVersion); _lastEfPathInput = customAssemblyPath; return (convertFullNameToGacPath ? str5 : efVersion); }