/// <summary>Gets the available controller classes from the given assembly.</summary> /// <returns>The controller classes.</returns> /// <exception cref="FileNotFoundException">The assembly could not be found.</exception> /// <exception cref="FileNotFoundException">The assembly config file could not be found..</exception> /// <exception cref="InvalidOperationException">No assembly paths have been provided.</exception> public override string[] GetControllerClasses() { if (Settings.AssemblyPaths == null || Settings.AssemblyPaths.Length == 0) { throw new InvalidOperationException("No assembly paths have been provided."); } if (!File.Exists(Settings.AssemblyPaths.First())) { throw new FileNotFoundException("The assembly could not be found.", Settings.AssemblyPaths.First()); } if (!string.IsNullOrEmpty(Settings.AssemblyConfig) && !File.Exists(Settings.AssemblyConfig)) { throw new FileNotFoundException("The assembly config file could not be found.", Settings.AssemblyConfig); } #if FullNet using (var isolated = new AppDomainIsolation <WebApiAssemblyLoader>(Path.GetDirectoryName(Path.GetFullPath(Settings.AssemblyPaths.First())), Settings.AssemblyConfig)) return(isolated.Object.GetControllerClasses(Settings.AssemblyPaths, GetAllReferencePaths(Settings))); #else var loader = new WebApiAssemblyLoader(); return(loader.GetControllerClasses(Settings.AssemblyPaths, GetAllReferencePaths(Settings))); #endif }
/// <summary>Gets the available controller classes from the given assembly.</summary> /// <returns>The controller classes.</returns> /// <exception cref="FileNotFoundException">The assembly could not be found.</exception> /// <exception cref="FileNotFoundException">The assembly config file could not be found..</exception> /// <exception cref="InvalidOperationException">No assembly paths have been provided.</exception> public override string[] GetControllerClasses() { if (Settings.AssemblyPaths == null || Settings.AssemblyPaths.Length == 0) throw new InvalidOperationException("No assembly paths have been provided."); if (!File.Exists(Settings.AssemblyPaths.First())) throw new FileNotFoundException("The assembly could not be found.", Settings.AssemblyPaths.First()); if (!string.IsNullOrEmpty(Settings.AssemblyConfig) && !File.Exists(Settings.AssemblyConfig)) throw new FileNotFoundException("The assembly config file could not be found.", Settings.AssemblyConfig); #if FullNet using (var isolated = new AppDomainIsolation<WebApiAssemblyLoader>(Path.GetDirectoryName(Path.GetFullPath(Settings.AssemblyPaths.First())), Settings.AssemblyConfig)) return isolated.Object.GetControllerClasses(Settings.AssemblyPaths, GetAllReferencePaths(Settings)); #else var loader = new WebApiAssemblyLoader(); return loader.GetControllerClasses(Settings.AssemblyPaths, GetAllReferencePaths(Settings)); #endif }
/// <summary>Gets the available controller classes from the given assembly.</summary> /// <returns>The controller classes.</returns> /// <exception cref="FileNotFoundException">The assembly could not be found.</exception> /// <exception cref="FileNotFoundException">The assembly config file could not be found..</exception> /// <exception cref="InvalidOperationException">No assembly paths have been provided.</exception> public override string[] GetControllerClasses() { if (Settings.AssemblyPaths == null || Settings.AssemblyPaths.Length == 0) { throw new InvalidOperationException("No assembly paths have been provided."); } if (!File.Exists(Settings.AssemblyPaths.First())) { throw new FileNotFoundException("The assembly could not be found.", Settings.AssemblyPaths.First()); } if (!string.IsNullOrEmpty(Settings.AssemblyConfig) && !File.Exists(Settings.AssemblyConfig)) { throw new FileNotFoundException("The assembly config file could not be found.", Settings.AssemblyConfig); } var loader = new WebApiAssemblyLoader(); return(loader.GetControllerClasses(Settings.AssemblyPaths, GetAllReferencePaths(Settings))); }