Show / Hide Table of Contents

Class ModuleCatalog

The ModuleCatalog holds information about the modules that can be used by the application. Each module is described in a ModuleInfo class, that records the name, type and location of the module. It also verifies that the ModuleCatalog is internally valid. That means that it does not have:

The ModuleCatalog also serves as a baseclass for more specialized Catalogs .

Inheritance
System.Object
ModuleCatalog
DirectoryModuleCatalog
Implements
IModuleCatalog
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Sartorius.SAF.Presentation.Modularity
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public class ModuleCatalog : IModuleCatalog

Constructors

View Source

ModuleCatalog()

Initializes a new instance of the ModuleCatalog class.

Declaration
public ModuleCatalog()
View Source

ModuleCatalog(IEnumerable<ModuleInfo>)

Initializes a new instance of the ModuleCatalog class while providing an initial list of ModuleInfos.

Declaration
public ModuleCatalog(IEnumerable<ModuleInfo> modules)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ModuleInfo> modules

The initial list of modules.

Properties

View Source

GrouplessModules

Returns the list of ModuleInfos that are not contained within any ModuleInfoGroup.

Declaration
protected IEnumerable<ModuleInfo> GrouplessModules { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ModuleInfo>

The groupless modules.

View Source

Groups

Gets the ModuleInfoGroups that have been added to the ModuleCatalog.

Declaration
public IEnumerable<ModuleInfoGroup> Groups { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ModuleInfoGroup>

The groups.

View Source

Items

Gets the items in the ModuleCatalog. This property is mainly used to add ModuleInfoGroups or ModuleInfos through XAML.

Declaration
public Collection<IModuleCatalogItem> Items { get; }
Property Value
Type Description
System.Collections.ObjectModel.Collection<IModuleCatalogItem>

The items in the catalog.

View Source

Modules

Gets all the ModuleInfo classes that are in the ModuleCatalog, regardless if they are within a ModuleInfoGroup or not.

Declaration
public virtual IEnumerable<ModuleInfo> Modules { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ModuleInfo>

The modules.

View Source

Validated

Gets or sets a value that remembers whether the ModuleCatalog has been validated already.

Declaration
protected bool Validated { get; set; }
Property Value
Type Description
System.Boolean

Methods

View Source

AddGroup(InitializationMode, String, ModuleInfo[])

Creates and adds a ModuleInfoGroup to the catalog.

Declaration
public virtual ModuleCatalog AddGroup(InitializationMode initializationMode, string refValue, params ModuleInfo[] moduleInfos)
Parameters
Type Name Description
InitializationMode initializationMode

Stage on which the module group to be added will be initialized.

System.String refValue

Reference to the location of the module group to be added.

ModuleInfo[] moduleInfos

Collection of ModuleInfo included in the group.

Returns
Type Description
ModuleCatalog

ModuleCatalog with the added module group.

View Source

AddModule(ModuleInfo)

Adds a ModuleInfo to the ModuleCatalog.

Declaration
public virtual void AddModule(ModuleInfo moduleInfo)
Parameters
Type Name Description
ModuleInfo moduleInfo

The ModuleInfo to add.

View Source

AddModule(String, String, InitializationMode, String[])

Adds a groupless ModuleInfo to the catalog.

Declaration
public ModuleCatalog AddModule(string moduleName, string moduleType, InitializationMode initializationMode, params string[] dependsOn)
Parameters
Type Name Description
System.String moduleName

Name of the module to be added.

System.String moduleType

System.Type of the module to be added.

InitializationMode initializationMode

Stage on which the module to be added will be initialized.

System.String[] dependsOn

Collection of module names (ModuleName) of the modules on which the module to be added logically depends on.

Returns
Type Description
ModuleCatalog

The same ModuleCatalog instance with the added module.

View Source

AddModule(String, String, String, InitializationMode, String[])

Adds a groupless ModuleInfo to the catalog.

Declaration
public ModuleCatalog AddModule(string moduleName, string moduleType, string refValue, InitializationMode initializationMode, params string[] dependsOn)
Parameters
Type Name Description
System.String moduleName

Name of the module to be added.

System.String moduleType

System.Type of the module to be added.

System.String refValue

Reference to the location of the module to be added assembly.

InitializationMode initializationMode

Stage on which the module to be added will be initialized.

System.String[] dependsOn

Collection of module names (ModuleName) of the modules on which the module to be added logically depends on.

Returns
Type Description
ModuleCatalog

The same ModuleCatalog instance with the added module.

View Source

AddModule(String, String, String[])

Adds a groupless ModuleInfo to the catalog.

Declaration
public ModuleCatalog AddModule(string moduleName, string moduleType, params string[] dependsOn)
Parameters
Type Name Description
System.String moduleName

Name of the module to be added.

System.String moduleType

System.Type of the module to be added.

System.String[] dependsOn

Collection of module names (ModuleName) of the modules on which the module to be added logically depends on.

Returns
Type Description
ModuleCatalog

The same ModuleCatalog instance with the added module.

View Source

AddModule(Type, InitializationMode, String[])

Adds a groupless ModuleInfo to the catalog.

Declaration
public ModuleCatalog AddModule(Type moduleType, InitializationMode initializationMode, params string[] dependsOn)
Parameters
Type Name Description
System.Type moduleType

System.Type of the module to be added.

InitializationMode initializationMode

Stage on which the module to be added will be initialized.

System.String[] dependsOn

Collection of module names (ModuleName) of the modules on which the module to be added logically depends on.

Returns
Type Description
ModuleCatalog

The same ModuleCatalog instance with the added module.

View Source

AddModule(Type, String[])

Adds a groupless ModuleInfo to the catalog.

Declaration
public ModuleCatalog AddModule(Type moduleType, params string[] dependsOn)
Parameters
Type Name Description
System.Type moduleType

System.Type of the module to be added.

System.String[] dependsOn

Collection of module names (ModuleName) of the modules on which the module to be added logically depends on.

Returns
Type Description
ModuleCatalog

The same ModuleCatalog instance with the added module.

View Source

CompleteListWithDependencies(IEnumerable<ModuleInfo>)

Returns a list of ModuleInfos that contain both the ModuleInfos in modules, but also all the modules they depend on.

Declaration
public virtual IEnumerable<ModuleInfo> CompleteListWithDependencies(IEnumerable<ModuleInfo> modules)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ModuleInfo> modules

The modules to get the dependencies for.

Returns
Type Description
System.Collections.Generic.IEnumerable<ModuleInfo>

A list of ModuleInfo that contains both all ModuleInfos in modules but also all the ModuleInfo they depend on.

View Source

CreateFromXaml(Stream)

Creates a ModuleCatalog from XAML.

Declaration
public static ModuleCatalog CreateFromXaml(Stream xamlStream)
Parameters
Type Name Description
System.IO.Stream xamlStream

System.IO.Stream that contains the XAML declaration of the catalog.

Returns
Type Description
ModuleCatalog

An instance of ModuleCatalog built from the XAML.

View Source

CreateFromXaml(Uri)

Creates a ModuleCatalog from a XAML included as an Application Resource.

Declaration
public static ModuleCatalog CreateFromXaml(Uri builderResourceUri)
Parameters
Type Name Description
System.Uri builderResourceUri

Relative System.Uri that identifies the XAML included as an Application Resource.

Returns
Type Description
ModuleCatalog

An instance of ModuleCatalog build from the XAML.

View Source

EnsureCatalogValidated()

Ensures that the catalog is validated.

Declaration
protected virtual void EnsureCatalogValidated()
View Source

GetDependentModules(ModuleInfo)

Return the list of ModuleInfos that moduleInfo depends on.

Declaration
public virtual IEnumerable<ModuleInfo> GetDependentModules(ModuleInfo moduleInfo)
Parameters
Type Name Description
ModuleInfo moduleInfo

The ModuleInfo to get the

Returns
Type Description
System.Collections.Generic.IEnumerable<ModuleInfo>

An enumeration of ModuleInfo that moduleInfo depends on.

Remarks

If the ModuleCatalog was not yet validated, this method will call Validate().

View Source

GetDependentModulesInner(ModuleInfo)

Returns the ModuleInfo on which the received module dependens on.

Declaration
protected virtual IEnumerable<ModuleInfo> GetDependentModulesInner(ModuleInfo moduleInfo)
Parameters
Type Name Description
ModuleInfo moduleInfo

Module whose dependant modules are requested.

Returns
Type Description
System.Collections.Generic.IEnumerable<ModuleInfo>

Collection of ModuleInfo dependants of moduleInfo.

View Source

Initialize()

Initializes the catalog, which may load and validate the modules.

Declaration
public virtual void Initialize()
Exceptions
Type Condition
ModularityException

When validation of the ModuleCatalog fails, because this method calls Validate().

View Source

InnerLoad()

Does the actual work of loading the catalog. The base implementation does nothing.

Declaration
protected virtual void InnerLoad()
View Source

Load()

Loads the catalog if necessary.

Declaration
public void Load()
View Source

SolveDependencies(IEnumerable<ModuleInfo>)

Checks for cyclic dependencies, by calling the dependency solver.

Declaration
protected static string[] SolveDependencies(IEnumerable<ModuleInfo> modules)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ModuleInfo> modules

A list of ModuleInfo.

Returns
Type Description
System.String[]
View Source

Sort(IEnumerable<ModuleInfo>)

Sorts a list of ModuleInfos. This method is called by CompleteListWithDependencies(IEnumerable<ModuleInfo>) to return a sorted list.

Declaration
protected virtual IEnumerable<ModuleInfo> Sort(IEnumerable<ModuleInfo> modules)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ModuleInfo> modules

The ModuleInfos to sort.

Returns
Type Description
System.Collections.Generic.IEnumerable<ModuleInfo>

Sorted list of ModuleInfos

View Source

Validate()

Validates the ModuleCatalog.

Declaration
public virtual void Validate()
Exceptions
Type Condition
ModularityException

When validation of the ModuleCatalog fails.

View Source

ValidateCrossGroupDependencies()

Ensures that there are no dependencies between modules on different groups.

Declaration
protected virtual void ValidateCrossGroupDependencies()
Remarks

A group-less module can only depend on other group-less modules. A module within a group can depend on other modules within the same group and/or on group-less modules.

View Source

ValidateDependencies(IEnumerable<ModuleInfo>)

Ensures that all the dependencies within modules refer to ModuleInfos within that list.

Declaration
protected static void ValidateDependencies(IEnumerable<ModuleInfo> modules)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ModuleInfo> modules

The modules to validate modules for.

Exceptions
Type Condition
ModularityException

Throws if a ModuleInfo in modules depends on a module that's not in modules.

System.ArgumentNullException

Throws if modules is null.

View Source

ValidateDependenciesInitializationMode()

Ensures that there are no modules marked to be loaded WhenAvailable depending on modules loaded OnDemand

Declaration
protected virtual void ValidateDependenciesInitializationMode()
View Source

ValidateDependencyGraph()

Ensures that there are no cyclic dependencies.

Declaration
protected virtual void ValidateDependencyGraph()
View Source

ValidateUniqueModules()

Makes sure all modules have an Unique name.

Declaration
protected virtual void ValidateUniqueModules()
Exceptions
Type Condition
DuplicateModuleException

Thrown if the names of one or more modules are not unique.

Implements

IModuleCatalog

Extension Methods

CollectionExtensions.AddRange<T, TCollection>(TCollection, IEnumerable<T>)
SerializableObjectCloneExtension.Clone<T>(T)
  • View Source
Back to top Generated by DocFX