public ModuleHostCallDispatcher(IModuleHost moduleHost) { this._moduleHost = moduleHost; postOperations = new ObservableCollection<DataItemCall>(); postOperations.CollectionChanged += HandleChange; }
public ModuleHostCallDispatcher(IModuleHost moduleHost) { this._moduleHost = moduleHost; postOperations = new ObservableCollection <DataItemCall>(); postOperations.CollectionChanged += HandleChange; }
/// <summary> /// Create module instance. /// </summary> /// <param name="host"></param> protected Module(IModuleHost host) { Host = host; Services = host.Services; Logger = Services.GetRequiredService <ILogger <Module> >(); _manifest = new Lazy <ModuleManifest>(() => Host.GetManifest(GetType())); }
public ModuleContainer(Uri path, Type type, IModuleAttribute attribute, IModuleHost host) { Host = host; Path = path; ModuleType = type; ModuleAttributes = attribute; LoadContext = new AssemblyLoader(path); }
/// <summary> /// Get service that belongs to the module. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="host"></param> /// <param name="provider"></param> /// <param name="moduleType"></param> /// <returns></returns> public static T GetService <T>(this IModuleHost host, IServiceProvider provider, Type moduleType) where T : notnull { var manifest = host.GetManifest(moduleType); var type = typeof(T); return(manifest.Services.Any(x => x.ServiceType == type) ? provider.GetRequiredService <T>() : throw new ModuleNotFoundException($"No such service for the module {moduleType.FullName}: {type.FullName}.")); }
/// <summary> /// Get option that belongs to the module. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="host"></param> /// <param name="provider"></param> /// <param name="moduleType"></param> /// <returns></returns> public static T GetOption <T>(this IModuleHost host, IServiceProvider provider, Type moduleType) where T : class { var manifest = host.GetManifest(moduleType); var type = typeof(T); return(manifest.Options.Any(x => x == type) ? provider.GetRequiredService <IOptionsSnapshot <T> >().Value : throw new ModuleNotFoundException($"No such option for the module {moduleType.FullName}: {type.FullName}.")); }
public static void InitializeModuleHost(IModuleHost moduleHost) { LoadedModules = new List<CloudCoreModule>(); AuthenticateHostApplication(); var registrar = new ModuleHostRegistrar(moduleHost); registrar.Register(); SyncAllModuleActions(); }
public static IModuleHost HasServices <T>(this IModuleHost host) where T : IModule { host.HasModule <T>(); var manifest = host.GetManifest <T>(); foreach (var item in manifest.Services) { host.HasService(item.ServiceType); } return(host); }
public static IModuleHost HasDependencies <T>(this IModuleHost host) where T : IModule { host.HasModule <T>(); var manifest = host.GetManifest <T>(); foreach (var item in manifest.Dependencies) { host.HasModule(item); } return(host); }
/// <summary> /// Find Modules. Direcotry depth can be controlled and is set to maximum depth by default. If you would like to create modules which /// are also ModuleHosts themselves, it is a good idea nest modules one directory level deep followed by nesting submodules another /// level deep. This will isolate parent modules from submodules. /// </summary> /// <param name="path">Where to search for DLL's which export IModule.</param> /// <param name="directoryDepth">How many subdirectories deep of path be searched.</param> public static IList <IModuleContainer> FindModules <T>(IModuleHost host, Uri path, int directoryDepth = int.MaxValue) where T : Module { var types = DllTypeSearch(typeof(T), path, directoryDepth); var containers = new List <IModuleContainer>(); foreach (var t in types) { var attribute = t.GetCustomAttribute <ModuleAttribute>(); if (attribute == null) { throw new NotImplementedException(string.Format("{0} Module must be decorated with a ModuleAttribute.", t.Name)); } attribute.Name = string.Format("{0}.{1}", t.Namespace, t.Name); attribute.Version = t.GetAssemblyInfo().Version; var location = t.GetPathToAssembly(false); containers.Add(new ModuleContainer(location, t, attribute, host)); } return(containers); }
public RazorComponentClientCoreModule(IModuleHost host, IRazorComponentClientModuleCollection collection) : base(host) { Collection = collection; }
/// <summary> /// Create the instance. /// </summary> /// <param name="host"></param> protected RazorComponentClientModule(IModuleHost host) : base(host) { Collection = host.GetRazorComponentClientModuleCollection(); _manifest = new Lazy <RazorComponentClientModuleManifest>(() => Collection.GetManifest(GetType())); }
public RazorComponentClientModuleCollection(IModuleHost host) : base(host) { Logger = host.Services.GetRequiredService <ILogger <RazorComponentClientModuleCollection> >(); }
/// <inheritdoc/> public VditorModule(IModuleHost host) : base(host) { }
/// <summary> /// Get razor component module host from service provider. /// </summary> /// <param name="host"></param> /// <returns></returns> public static IRazorComponentClientModuleCollection GetRazorComponentClientModuleCollection(this IModuleHost host) => host.Services.GetRequiredService <IRazorComponentClientModuleCollection>();
public ItemMetadataServerGraphqlModule(IModuleHost host) : base(host) { }
/// <inheritdoc/> public AntDesignModule(IModuleHost host) : base(host) { }
public TestDepDepModule(IModuleHost host) : base(host) { }
public HelloServerModule(IModuleHost host) : base(host) { }
public BlazorUIProvider(IModuleHost host) : base(host) { }
internal EventCollection(IModuleHost host) { Host = host; Instantiated = new Dictionary <Type, IEvent>(); }
/// <summary> /// Create instance. /// </summary> /// <param name="host"></param> public BlazorUiModule(IModuleHost host) : base(host) { }
public OptionTestModule(IModuleHost host) : base(host) { }
/// <summary> /// Create the instance. /// </summary> /// <param name="host"></param> public ObjectStorageApiModule(IModuleHost host) : base(host) { }
public CommandLineModuleCollection(IModuleHost host) : base(host) { }
/// <inheritdoc/> public BootstrapModule(IModuleHost host) : base(host) { }
/// <summary> /// Get aspnet module host from service provider. /// </summary> /// <param name="host"></param> /// <returns></returns> public static IAspNetServerModuleCollection GetAspNetServerModuleCollection(this IModuleHost host) => host.Services.GetRequiredService <IAspNetServerModuleCollection>();
/// <summary> /// Get page provider. /// </summary> /// <param name="module"></param> /// <param name="host"></param> /// <returns></returns> public static IPageProvider?GetPageProvider(this IRazorComponentClientModule module, IModuleHost host) { var collection = host.GetRazorComponentClientModuleCollection(); var manifest = collection.GetManifest(module.GetType()); if (manifest.PageProvider is not null) { return((IPageProvider)host.Services.GetRequiredService(manifest.PageProvider)); } return(null); }
public ModuleHostRegistrar(IModuleHost moduleHost) { this.moduleHost = moduleHost; }
public PersonsModule(IModuleHost host) : base(host) { }
/// <summary> /// Creates a new instance of ModuleCollection. /// </summary> public ModuleCollection(IModuleHost host) { Containers = new List <IModuleContainer>(); Host = host; }
public TestModule(IModuleHost host) : base(host) { }
public BookkeepingModule(IModuleHost host) : base(host) { }