public void AfterPluginsLoaded(IAppHost appHost) { var scannedTypes = new List <Type>(); foreach (var assembly in LoadFromAssemblies) { try { scannedTypes.AddRange(assembly.GetTypes()); } catch (Exception ex) { appHost.NotifyStartupException(ex); } } var misingRequestTypes = scannedTypes .Where(x => x.HasInterface(typeof(IQueryDb))) .Where(x => !appHost.Metadata.OperationsMap.ContainsKey(x)) .ToList(); if (misingRequestTypes.Count == 0) { return; } var serviceType = GenerateMissingServices(misingRequestTypes); appHost.RegisterService(serviceType); }
public void Register(IAppHost appHost) { this.ScanRootPath = this.ScanRootPath ?? appHost.Config.WebHostPhysicalPath; this.VirtualFileSources = VirtualFileSources ?? appHost.VirtualFileSources; this.WebHostUrl = WebHostUrl ?? appHost.Config.WebHostUrl; this.EnableLiveReload = this.EnableLiveReload ?? appHost.Config.DebugMode; if (CheckLastModifiedForChanges == true) { EnableLiveReload = false; //Don't enable both File Watcher + LastModified checks } this.PrecompilePages = this.PrecompilePages ?? !this.EnableLiveReload; this.WaitForPrecompilationOnStartup = this.WaitForPrecompilationOnStartup ?? !this.EnableLiveReload; if (LoadUnloadedAssemblies) { var loadedAssemblyNames = CompilerServices .GetLoadedAssemblies() .Where(x => !x.IsDynamic) .Map(x => x.FullName.SplitOnFirst(',')[0]); foreach (var razorNamespace in appHost.Config.RazorNamespaces) { try { if (razorNamespace.StartsWith("System") || razorNamespace.StartsWith("ServiceStack")) { continue; } if (!loadedAssemblyNames.Contains(razorNamespace)) { Assembly.Load(razorNamespace); } } catch { /*Ignore namespaces that don't map to assemblies*/ } } } try { Init(); BindToAppHost(appHost); } catch (Exception ex) { appHost.NotifyStartupException(ex); throw; } }
public void Register(IAppHost appHost) { this.ScanRootPath = this.ScanRootPath ?? appHost.Config.WebHostPhysicalPath; this.VirtualPathProvider = VirtualPathProvider ?? appHost.VirtualPathProvider; this.WebHostUrl = WebHostUrl ?? appHost.Config.WebHostUrl; this.EnableLiveReload = this.EnableLiveReload ?? appHost.Config.DebugMode; try { Init(); BindToAppHost(appHost); } catch (Exception ex) { appHost.NotifyStartupException(ex); throw; } }
public void Register(IAppHost appHost) { this.ScanRootPath = this.ScanRootPath ?? appHost.Config.WebHostPhysicalPath; this.VirtualPathProvider = VirtualPathProvider ?? appHost.VirtualPathProvider; this.WebHostUrl = WebHostUrl ?? appHost.Config.WebHostUrl; this.EnableLiveReload = this.EnableLiveReload ?? appHost.Config.DebugMode; this.PrecompilePages = this.PrecompilePages ?? !this.EnableLiveReload; this.WaitForPrecompilationOnStartup = this.WaitForPrecompilationOnStartup ?? !this.EnableLiveReload; try { Init(); BindToAppHost(appHost); } catch (Exception ex) { appHost.NotifyStartupException(ex); throw; } }
public void Register(IAppHost appHost) { this.ScanRootPath = this.ScanRootPath ?? appHost.Config.WebHostPhysicalPath; this.VirtualFileSources = VirtualFileSources ?? appHost.VirtualFileSources; this.WebHostUrl = WebHostUrl ?? appHost.Config.WebHostUrl; this.EnableLiveReload = this.EnableLiveReload ?? appHost.Config.DebugMode; if (CheckLastModifiedForChanges == true) EnableLiveReload = false; //Don't enable both File Watcher + LastModified checks this.PrecompilePages = this.PrecompilePages ?? !this.EnableLiveReload; this.WaitForPrecompilationOnStartup = this.WaitForPrecompilationOnStartup ?? !this.EnableLiveReload; if (LoadUnloadedAssemblies) { var loadedAssemblyNames = CompilerServices .GetLoadedAssemblies() .Where(x => !x.IsDynamic) .Map(x => x.FullName.SplitOnFirst(',')[0]); foreach (var razorNamespace in appHost.Config.RazorNamespaces) { try { if (razorNamespace.StartsWith("System") || razorNamespace.StartsWith("ServiceStack")) continue; if (!loadedAssemblyNames.Contains(razorNamespace)) { Assembly.Load(razorNamespace); } } catch { /*Ignore namespaces that don't map to assemblies*/ } } } try { Init(); BindToAppHost(appHost); } catch (Exception ex) { appHost.NotifyStartupException(ex); throw; } }