public void Load() { CheckInstallPath(); string strVersion = (string)ConfigurationManager.AppSettings["MapSurfer.Version"]; AssemblyLoader.Register(strVersion); Assembly assembly = AssemblyLoader.LoadAssembly("MapSurfer.Web.dll"); if (assembly == null) throw new FileNotFoundException("MapSurfer.Web.dll"); string typeName = "MapSurfer.Web.Services.MappingService"; object[] args = new object[] { (string)ConfigurationManager.AppSettings["MapSurfer.ServiceName"] }; try { m_mapService = assembly.CreateInstance(typeName, true, BindingFlags.CreateInstance, null, args, System.Globalization.CultureInfo.InvariantCulture, null); MethodInfo methodProcessReq = m_mapService.GetType().GetMethod("ProcessRequest"); m_processReqDelegate = (ProcessRequestDelegate)Delegate.CreateDelegate(typeof(ProcessRequestDelegate), m_mapService, methodProcessReq); MethodInfo methodGetMapUrls = m_mapService.GetType().GetMethod("GetMapUrls"); m_getMapUrlsDelegate = (GetMapUrlsDelegate)Delegate.CreateDelegate(typeof(GetMapUrlsDelegate), m_mapService, methodGetMapUrls); } catch (TargetInvocationException tiex) { throw tiex.GetBaseException(); } AssemblyLoader.Unregister(); }
public void Load() { CheckInstallPath(); string strVersion = (string)ConfigurationManager.AppSettings["MapSurfer.Version"]; AssemblyLoader.Register(strVersion); Assembly assembly = AssemblyLoader.LoadAssembly("MapSurfer.Web.dll"); if (assembly == null) { throw new FileNotFoundException("MapSurfer.Web.dll"); } string typeName = "MapSurfer.Web.Services.MappingService"; object[] args = new object[] { (string)ConfigurationManager.AppSettings["MapSurfer.ServiceName"] }; try { m_mapService = assembly.CreateInstance(typeName, true, BindingFlags.CreateInstance, null, args, System.Globalization.CultureInfo.InvariantCulture, null); MethodInfo methodProcessReq = m_mapService.GetType().GetMethod("ProcessRequest"); m_processReqDelegate = (ProcessRequestDelegate)Delegate.CreateDelegate(typeof(ProcessRequestDelegate), m_mapService, methodProcessReq); MethodInfo methodGetMapUrls = m_mapService.GetType().GetMethod("GetMapUrls"); m_getMapUrlsDelegate = (GetMapUrlsDelegate)Delegate.CreateDelegate(typeof(GetMapUrlsDelegate), m_mapService, methodGetMapUrls); } catch (TargetInvocationException tiex) { throw tiex.GetBaseException(); } AssemblyLoader.Unregister(); }