/// <summary> /// Extracts XML assembly information from adpl_sat table in BizTalkMgmtDb table, searches for and loads the System.Reflection.Assembly object from its physical location. /// </summary> /// <param name="assemblyDisplayName">DisplayName property of ExplorerOM.BtsAssembly object.</param> /// <returns>loaded System.Reflection.Assembly object.</returns> public static Assembly GetAssembly(string assemblyDisplayName) { var fname = String.Empty; var conn = new SqlConnection(CatalogExplorerS.GetCatalogExplorer().ConnectionString); try { conn.Open(); var sb = new SqlCommand( String.Format("select properties from adpl_sat where luid='{0}'", assemblyDisplayName), conn); var read = sb.ExecuteXmlReader(); var doc = new XmlDocument(); doc.Load(read); var nav = doc.CreateNavigator(); if (nav != null) { nav.MoveToRoot(); var iterator = nav.SelectSingleNode("DictionarySerializer2OfStringObject/dictionary/item[key = \"SourceLocation\"]"); var fullFileName = iterator.SelectChildren("SourceLocation", ""); if (null == fullFileName.Current.Value) { ///TODO: research if %BTAD_Installdir% in properties column expands as needed, or what -- what IF SourceLocation doesn't exist? does that happen?s Debugger.Break(); } if (fullFileName.Current.Value != null) { fname = fullFileName.Current.Value.Replace("SourceLocation", ""); } } } catch (Exception) { #if DEBUG Debugger.Break(); #endif } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } } Debug.WriteLine("loading file " + fname); return(Assembly.LoadFile(fname)); }
public static Application GetApplication(string appName) { if (null != CatalogExplorerS.GetCatalogExplorer().Applications[appName]) _app = CatalogExplorerS.GetCatalogExplorer().Applications[appName]; else { #if DEBUG ///TODO: Exception Handling Debugger.Break(); #endif _app = null; } return _app; }