Files
DP44/docs/ai/Common/DTS.Common/ModuleCatalog.md
2026-04-17 14:55:32 -04:00

3.1 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common/ModuleCatalog/AggregateModuleCatalog.cs
2026-04-17T16:39:46.691018+00:00 zai-org/GLM-5-FP8 1 9c34696a3d6323c2

AggregateModuleCatalog Documentation

1. Purpose

AggregateModuleCatalog is an implementation of IModuleCatalog that aggregates multiple module catalogs into a single unified interface. It enables composition of module catalogs from different sources (e.g., configuration files, dynamic discovery, explicit registration) while presenting them as a single catalog to the Prism modularity system. This class delegates operations to the underlying catalogs while coordinating results across all of them.

2. Public Interface

Constructor

public AggregateModuleCatalog()

Initializes a new instance with a default ModuleCatalog as the first catalog in the aggregate collection.


AddCatalog

public void AddCatalog(IModuleCatalog catalog)

Adds a module catalog to the aggregate collection. Throws ArgumentNullException if catalog is null.


Modules

public IEnumerable<ModuleInfo> Modules { get; }

Returns all ModuleInfo instances across all aggregated catalogs by projecting and flattening each catalog's Modules property.


GetDependentModules

public IEnumerable<ModuleInfo> GetDependentModules(ModuleInfo moduleInfo)

Locates the catalog containing moduleInfo and returns its dependencies. Uses Single() to find the owning catalog, meaning the module must exist in exactly one catalog or an exception will be thrown.


CompleteListWithDependencies

public IEnumerable<ModuleInfo> CompleteListWithDependencies(IEnumerable<ModuleInfo> modules)

Returns the complete list of modules including all transitive dependencies. Groups modules by their owning catalog and delegates to each catalog's CompleteListWithDependencies method.


Initialize

public void Initialize()

Iterates through all catalogs and calls Initialize() on each one.


AddModule

public void AddModule(ModuleInfo moduleInfo)

Adds a ModuleInfo to the first catalog in the collection (the default ModuleCatalog created in the constructor).

3. Invariants

  • Non-empty catalog collection: The _catalogs list always contains at least one catalog after construction (the default ModuleCatalog at index 0).
  • Module uniqueness assumption: GetDependentModules and CompleteListWithDependencies assume each ModuleInfo exists in exactly one catalog. The use of Single() enforces this—if a module is not found or found in multiple catalogs, an exception will be thrown.
  • Null rejection: AddCatalog will not accept null catalogs and throws ArgumentNullException.

4. Dependencies

This module depends on:

  • Microsoft.Practices.Prism.Modularity — Provides IModuleCatalog, ModuleInfo, and ModuleCatalog types from the Prism library.
  • System, System.Collections.Generic, System.Linq — Standard .NET framework types.

What depends on this module:

  • **Unc