Ejemplo n.º 1
0
 private void ChooseTypeName()
 {
     if (!File.Exists(this.txtAssemblyPath.Text.Trim()))
     {
         MessageBox.Show("The assembly '" + this.txtAssemblyPath.Text.Trim() + "' does not exist.");
     }
     else
     {
         string[] customTypeNames;
         try
         {
             customTypeNames = this.GetCustomTypeNames();
         }
         catch (Exception exception)
         {
             MessageBox.Show(exception.Message + ((exception.InnerException == null) ? "" : ("\r\n" + exception.InnerException.Message)));
             return;
         }
         if (customTypeNames.Length == 0)
         {
             MessageBox.Show("There are no types based on System.Data.Entity.DbContext in that assembly.");
         }
         else
         {
             using (ChooseTypeForm form = new ChooseTypeForm(this.txtAssemblyPath.Text.Trim(), customTypeNames, this.txtTypeName.Text.Trim(), null, null))
             {
                 if (form.ShowDialog() == DialogResult.OK)
                 {
                     this.txtTypeName.Text = form.SelectedTypeName;
                     this.ProbeType();
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void ChooseTypeName()
 {
     if (!File.Exists(this.txtAssemblyPath.Text.Trim()))
     {
         MessageBox.Show("The assembly '" + this.txtAssemblyPath.Text.Trim() + "' does not exist.");
     }
     else
     {
         string[] customTypeNames;
         try
         {
             customTypeNames = this.GetCustomTypeNames();
         }
         catch (Exception exception)
         {
             MessageBox.Show(exception.Message + ((exception.InnerException == null) ? "" : ("\r\n" + exception.InnerException.Message)));
             return;
         }
         if (customTypeNames.Length == 0)
         {
             MessageBox.Show("There are no types based on System.Data.Entity.DbContext in that assembly.");
         }
         else
         {
             using (ChooseTypeForm form = new ChooseTypeForm(this.txtAssemblyPath.Text.Trim(), customTypeNames, this.txtTypeName.Text.Trim(), null, null))
             {
                 if (form.ShowDialog() == DialogResult.OK)
                 {
                     this.txtTypeName.Text = form.SelectedTypeName;
                     this.ProbeType();
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 private void ChooseTypeName()
 {
     ThreadStart start = null;
     if (!File.Exists(this.txtAssemblyPath.Text.Trim()))
     {
         MessageBox.Show("The assembly '" + this.txtAssemblyPath.Text.Trim() + "' does not exist.");
     }
     else
     {
         string[] data;
         string[] strArray2;
         Repository r = new Repository();
         this.UpdateRepository(r);
         using (DomainIsolator isolator = new DomainIsolator("Inspect Custom Assembly"))
         {
             isolator.Domain.SetData("assem", this.txtAssemblyPath.Text.Trim());
             isolator.Domain.SetData("loader", r.DriverLoader);
             try
             {
                 isolator.Domain.DoCallBack(new CrossAppDomainDelegate(CxForm.GetCustomTypes));
                 data = (string[]) isolator.Domain.GetData("types");
                 strArray2 = (string[]) isolator.Domain.GetData("metadata");
             }
             catch (Exception exception)
             {
                 Log.Write(exception, "CxForm GetCustomTypes");
                 MessageBox.Show("Error loading custom assembly:\r\n\r\n" + exception.Message, "LINQPad", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 return;
             }
         }
         if (data.Length == 0)
         {
             MessageBox.Show("There are no types based on '" + r.DriverLoader.Driver.ContextBaseTypeName + "' in that assembly.");
         }
         else
         {
             if (this.cboSchema.SelectedIndex < 2)
             {
                 strArray2 = null;
             }
             using (ChooseTypeForm form = new ChooseTypeForm(this.txtAssemblyPath.Text.Trim(), data, this.txtTypeName.Text.Trim(), strArray2, this.txtMetadataPath.Text.Trim()))
             {
                 if (form.ShowDialog() == DialogResult.OK)
                 {
                     this.txtTypeName.Text = form.SelectedTypeName;
                     this.txtMetadataPath.Text = form.SelectedMetadataName;
                     if (this.AreDbDetailsBlank())
                     {
                         if (start == null)
                         {
                             start = delegate {
                                 try
                                 {
                                     this.ProbeDefaultCxString();
                                 }
                                 catch (Exception exception)
                                 {
                                     Log.Write(exception, "CxForm ProbeDefaultCxString");
                                 }
                             };
                         }
                         new Thread(start) { Name = "Default Cx String Probe", IsBackground = true }.Start();
                     }
                 }
             }
         }
     }
 }