Example #1
0
 private string[] GetCustomTypeNames()
 {
     using (DomainIsolator isolator = this.GetDomainIsolatorForProber("EF Assembly Prober", false))
     {
         return(isolator.GetInstance <AssemblyProber>().GetCustomTypeNames(this.txtAssemblyPath.Text.Trim()));
     }
 }
 private List <ExplorerItem> GetExplorerItems()
 {
     using (DomainIsolator isolator = new DomainIsolator(base.Repository.CreateSchemaAndRunnerDomain("Custom schema resolver", false, false)))
     {
         return(isolator.GetInstance <SchemaRetriever>().GetSchema(base.Repository) ?? new List <ExplorerItem>());
     }
 }
Example #3
0
 private void GetConstructorInfo(out bool parameterlessCtor, out string stringCtorParamName)
 {
     using (DomainIsolator isolator = this.GetDomainIsolatorForProber("EF Assembly Prober", false))
     {
         isolator.GetInstance <AssemblyProber>().GetConstructorInfo(this.txtAssemblyPath.Text.Trim(), this.txtTypeName.Text.Trim(), out parameterlessCtor, out stringCtorParamName);
     }
 }
 public static DCDriverInfo[] GetThirdPartyDrivers()
 {
     using (DomainIsolator isolator = new DomainIsolator("DataContextDriver prober"))
     {
         return isolator.GetInstance<ThirdPartyDriverProber>().GetThirdPartyDriversInternal();
     }
 }
Example #5
0
 public static DCDriverInfo[] GetThirdPartyDrivers()
 {
     using (DomainIsolator isolator = new DomainIsolator("DataContextDriver prober"))
     {
         return(isolator.GetInstance <ThirdPartyDriverProber>().GetThirdPartyDriversInternal());
     }
 }
 public static DCDriverInfo[] GetDriversInAssembly(string assemblyPath)
 {
     using (DomainIsolator isolator = new DomainIsolator("DataContextDriver prober"))
     {
         return isolator.GetInstance<ThirdPartyDriverProber>().GetDriversInAssemblyInternal(assemblyPath);
     }
 }
Example #7
0
 public static DCDriverInfo[] GetDriversInAssembly(string assemblyPath)
 {
     using (DomainIsolator isolator = new DomainIsolator("DataContextDriver prober"))
     {
         return(isolator.GetInstance <ThirdPartyDriverProber>().GetDriversInAssemblyInternal(assemblyPath));
     }
 }
Example #8
0
 internal string ShowConnectionDialog(string repositoryData, bool isNewRepository)
 {
     using (DomainIsolator isolator = new DomainIsolator(this.CreateNewDriverDomain("ShowConnectionDialog for " + this.SimpleAssemblyName, null, null)))
     {
         return(isolator.GetInstance <Instantiator>().Instantiate(this.GetAssemblyPath(), this.FullTypeName).ShowConnectionDialog(repositoryData, isNewRepository));
     }
 }
Example #9
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);
        }
Example #10
0
 public static bool IsLINQPadGaced()
 {
     bool flag;
     try
     {
         using (DomainIsolator isolator = new DomainIsolator("LINQPad GAC Tester"))
         {
             flag = isolator.GetInstance<LINQPadGacTester>().IsGaced(new LINQPadGacTester().GetFileVersion());
         }
     }
     catch (TypeLoadException)
     {
         flag = true;
     }
     catch
     {
         flag = false;
     }
     return flag;
 }
Example #11
0
        public static bool IsLINQPadGaced()
        {
            bool flag;

            try
            {
                using (DomainIsolator isolator = new DomainIsolator("LINQPad GAC Tester"))
                {
                    flag = isolator.GetInstance <LINQPadGacTester>().IsGaced(new LINQPadGacTester().GetFileVersion());
                }
            }
            catch (TypeLoadException)
            {
                flag = true;
            }
            catch
            {
                flag = false;
            }
            return(flag);
        }
Example #12
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            BackgroundWorker worker2 = new BackgroundWorker {
                WorkerSupportsCancellation = true
            };
            string     arg       = this.rbStringConstructor.Checked ? this.txtCxString.Text.Trim() : null;
            Repository testRepos = ((Repository)this._cxInfo).Clone();

            this.UpdateRepository(testRepos);
            worker2.DoWork += delegate(object sender, DoWorkEventArgs e) {
                using (DomainIsolator isolator = this.GetDomainIsolatorForProber("EF Connection Tester", true))
                {
                    isolator.GetInstance <AssemblyProber>().Test(testRepos, arg);
                }
            };
            using (WorkerForm form = new WorkerForm(worker2, "Testing...", true))
            {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            MessageBox.Show("Successful", "LINQPad", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }
 internal string ShowConnectionDialog(string repositoryData, bool isNewRepository)
 {
     using (DomainIsolator isolator = new DomainIsolator(this.CreateNewDriverDomain("ShowConnectionDialog for " + this.SimpleAssemblyName, null, null)))
     {
         return isolator.GetInstance<Instantiator>().Instantiate(this.GetAssemblyPath(), this.FullTypeName).ShowConnectionDialog(repositoryData, isNewRepository);
     }
 }
 private List<ExplorerItem> GetExplorerItems()
 {
     using (DomainIsolator isolator = new DomainIsolator(base.Repository.CreateSchemaAndRunnerDomain("Custom schema resolver", false, false)))
     {
         return (isolator.GetInstance<SchemaRetriever>().GetSchema(base.Repository) ?? new List<ExplorerItem>());
     }
 }
 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 void UpdateSchema()
 {
     object obj2;
     LINQPad.Repository repository;
     lock ((obj2 = this._locker))
     {
         if ((this._worker != Thread.CurrentThread) || this._disposed)
         {
             return;
         }
         this._status = "Populating";
     }
     this.NotifyChange();
     TempFileRef random = TempFileRef.GetRandom("TypedDataContext", ".dll");
     AssemblyName assemblyToBuild = new AssemblyName(Path.GetFileNameWithoutExtension(random.FileName)) {
         CodeBase = random.FullPath
     };
     lock ((obj2 = this._locker))
     {
         if ((this._worker != Thread.CurrentThread) || this._disposed)
         {
             return;
         }
         repository = this._repository.Clone();
     }
     IEnumerable<ExplorerItem> enumerable = null;
     string nameSpace = "LINQPad.User";
     string typeName = "TypedDataContext";
     IDictionary<string, object> sessionData = null;
     using (DomainIsolator isolator = new DomainIsolator(repository.DriverLoader.CreateNewDriverDomain("LINQPad Schema Generator", null, null)))
     {
         enumerable = isolator.GetInstance<SchemaBuilder>().GetSchemaAndBuildAssembly(repository.GetStore().ToString(), assemblyToBuild, ref nameSpace, ref typeName, Program.AllowOneToOne, out sessionData);
     }
     lock ((obj2 = this._locker))
     {
         if (this._worker == Thread.CurrentThread)
         {
             this._repository.AutoGenNamespace = nameSpace;
             this._repository.AutoGenTypeName = typeName;
             this._repository.IsAutoGenAssemblyAvailable = true;
             if (sessionData != null)
             {
                 this._repository.SessionData = sessionData;
             }
             this._schema = enumerable;
             this._assemblyPath = random;
         }
     }
 }