Пример #1
0
 public static void UpdateAdditionalRefs(QueryCore q)
 {
     try
     {
         _query          = q;
         _additionalRefs = q.AllFileReferences.Union <string>((from r in q.AdditionalGACReferences
                                                               select GacResolver.FindPath(r) into r
                                                               where r != null
                                                               select r)).ToArray <string>();
     }
     catch
     {
         _additionalRefs = "".Split(new char[0]);
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
        internal string[] TryGetFullAssembliesToAdd(string staticDataContextFolder, IConnectionInfo cxInfo)
        {
            var selector = null;

            if (this.IsBuiltIn)
            {
                if (this._assembliesToAdd != null)
                {
                    return(this._assembliesToAdd);
                }
                if (this.AssembliesToAddError != null)
                {
                    return(null);
                }
            }
            try
            {
                IEnumerable <string> source = from a in this.GetAssembliesToAdd(cxInfo) ?? ((IEnumerable <string>) new string[0]) select a.Contains <char>(',') ? ((IEnumerable <string>)(GacResolver.FindPath(a) ?? (a.Split(new char[] { ',' }).First <string>() + ".dll"))) : ((IEnumerable <string>)a);

                string driverFolder = this.GetDriverFolder();
                if (!((!this.IsBuiltIn && !string.IsNullOrEmpty(driverFolder)) && Directory.Exists(driverFolder)))
                {
                    driverFolder = null;
                }
                if (selector == null)
                {
                    selector = a => new { a = a, fullPath1 = string.IsNullOrEmpty(staticDataContextFolder) ? "" : Path.Combine(staticDataContextFolder, a) };
                }
                this._assembliesToAdd = (from <> h__TransparentIdentifier0 in source.Select(selector)
                                         let fullPath2 = string.IsNullOrEmpty(driverFolder) ? ((IEnumerable <string>) "") : ((IEnumerable <string>)Path.Combine(driverFolder, <> h__TransparentIdentifier0.a))
                                                         select((< > h__TransparentIdentifier0.fullPath1 == "") || !File.Exists(< > h__TransparentIdentifier0.fullPath1)) ? (((fullPath2 == "") || !File.Exists(fullPath2)) ? ((IEnumerable <string>) < > h__TransparentIdentifier0.a) : ((IEnumerable <string>)fullPath2)) : ((IEnumerable <string>) < > h__TransparentIdentifier0.fullPath1)).Union <string>(new string[] { base.GetType().Assembly.Location }).ToArray <string>();
            }
            catch (Exception exception)
            {
                this.AssembliesToAddError = exception;
            }
            return(this._assembliesToAdd);
        }