Exemplo n.º 1
0
        public ModuleHostCallDispatcher(IModuleHost moduleHost)
        {
            this._moduleHost = moduleHost;

            postOperations = new ObservableCollection<DataItemCall>();
            postOperations.CollectionChanged += HandleChange;
        }
Exemplo n.º 2
0
        public ModuleHostCallDispatcher(IModuleHost moduleHost)
        {
            this._moduleHost = moduleHost;

            postOperations = new ObservableCollection <DataItemCall>();
            postOperations.CollectionChanged += HandleChange;
        }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 5
0
        /// <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}."));
        }
Exemplo n.º 6
0
        /// <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}."));
        }
Exemplo n.º 7
0
        public static void InitializeModuleHost(IModuleHost moduleHost)
        {
            LoadedModules = new List<CloudCoreModule>();
            AuthenticateHostApplication();
            
            var registrar = new ModuleHostRegistrar(moduleHost);
            registrar.Register();

            SyncAllModuleActions();
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        /// <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);
        }
Exemplo n.º 11
0
 public RazorComponentClientCoreModule(IModuleHost host, IRazorComponentClientModuleCollection collection) : base(host)
 {
     Collection = collection;
 }
Exemplo n.º 12
0
 /// <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> >();
 }
Exemplo n.º 14
0
 /// <inheritdoc/>
 public VditorModule(IModuleHost host) : base(host)
 {
 }
Exemplo n.º 15
0
 /// <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)
 {
 }
Exemplo n.º 17
0
 /// <inheritdoc/>
 public AntDesignModule(IModuleHost host) : base(host)
 {
 }
Exemplo n.º 18
0
 public TestDepDepModule(IModuleHost host) : base(host)
 {
 }
Exemplo n.º 19
0
 public HelloServerModule(IModuleHost host) : base(host)
 {
 }
Exemplo n.º 20
0
 public BlazorUIProvider(IModuleHost host) : base(host)
 {
 }
 internal EventCollection(IModuleHost host)
 {
     Host         = host;
     Instantiated = new Dictionary <Type, IEvent>();
 }
Exemplo n.º 22
0
 /// <summary>
 /// Create instance.
 /// </summary>
 /// <param name="host"></param>
 public BlazorUiModule(IModuleHost host) : base(host)
 {
 }
Exemplo n.º 23
0
 public OptionTestModule(IModuleHost host) : base(host)
 {
 }
Exemplo n.º 24
0
 /// <summary>
 /// Create the instance.
 /// </summary>
 /// <param name="host"></param>
 public ObjectStorageApiModule(IModuleHost host) : base(host)
 {
 }
 public CommandLineModuleCollection(IModuleHost host) : base(host)
 {
 }
Exemplo n.º 26
0
 /// <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>();
Exemplo n.º 28
0
        /// <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);
        }
Exemplo n.º 29
0
 public ModuleHostRegistrar(IModuleHost moduleHost)
 {
     this.moduleHost = moduleHost;
 }
Exemplo n.º 30
0
 public PersonsModule(IModuleHost host) : base(host)
 {
 }
 /// <summary>
 /// Creates a new instance of ModuleCollection.
 /// </summary>
 public ModuleCollection(IModuleHost host)
 {
     Containers = new List <IModuleContainer>();
     Host       = host;
 }
Exemplo n.º 32
0
 public TestModule(IModuleHost host) : base(host)
 {
 }
Exemplo n.º 33
0
 public BookkeepingModule(IModuleHost host) : base(host)
 {
 }