[mapguide-commits] r5123 - sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Sep 8 01:22:48 EDT 2010


Author: jng
Date: 2010-09-08 05:22:48 +0000 (Wed, 08 Sep 2010)
New Revision: 5123

Modified:
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs
Log:
forward-port ConnectionProviders.xml detection and assembly loading logic from 2.1 stream


Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs	2010-09-08 05:08:15 UTC (rev 5122)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs	2010-09-08 05:22:48 UTC (rev 5123)
@@ -60,13 +60,20 @@
         static Dictionary<string, Type> _ctors;
         static List<ConnectionProviderEntry> _providers;
 
+        static string _dllRoot;
+
         static ConnectionProviderRegistry()
         {
             _ctors = new Dictionary<string, Type>();
             _providers = new List<ConnectionProviderEntry>();
 
+            var dir = System.IO.Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
+            var path = System.IO.Path.Combine(dir, PROVIDER_CONFIG);
+
+            _dllRoot = System.IO.Path.GetDirectoryName(path);
+
             XmlDocument doc = new XmlDocument();
-            doc.Load(PROVIDER_CONFIG);
+            doc.Load(path);
 
             XmlNodeList providers = doc.SelectNodes("//ConnectionProviderRegistry/ConnectionProvider");
             foreach (XmlNode prov in providers)
@@ -76,6 +83,9 @@
                 string dll = prov["Assembly"].InnerText;
                 string type = prov["Type"].InnerText;
 
+                if (!System.IO.Path.IsPathRooted(dll))
+                    dll = System.IO.Path.Combine(_dllRoot, dll);
+
                 try
                 {
                     Assembly asm = Assembly.LoadFrom(dll);



More information about the mapguide-commits mailing list