This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
---
source_files:
- DataPRO/DataPRO.Core/ServiceManager/IServicePublishedEvent.cs
- DataPRO/DataPRO.Core/ServiceManager/ServicePublishedEvent.cs
- DataPRO/DataPRO.Core/ServiceManager/ServiceManager.cs
generated_at: "2026-04-17T16:36:18.703341+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "5cab21cff0e733cd"
---
# ServiceManager Module Documentation
## 1. Purpose
The ServiceManager module implements a service locator pattern, enabling decoupled component communication within the application. It allows components to publish implementations of singleton interfaces (services) that other components can retrieve without direct knowledge of the publisher. The module provides event-driven notification when services are published or unpublished, supporting reactive architectures where consumers need to respond to service availability changes.
---
## 2. Public Interface
### ServiceManager (Static Class)
A static service locator that manages a registry of interface-to-implementation mappings.
| Method | Signature | Description |
|--------|-----------|-------------|
| `Publish<T>` | `void Publish<T>(T item) where T : class` | Publishes a service implementation under its interface type `T`. Throws `ArgumentException` if the type is already published. |
| `Publish` | `void Publish(object item, IEnumerable<Type> interfaceList, bool skipPublishedInterfaces)` | Publishes a single object under multiple interface types. If `skipPublishedInterfaces` is `true`, silently skips already-published interfaces; otherwise throws `ArgumentException`. |
| `Exists<T>` | `bool Exists<T>() where T : class` | Returns `true` if interface type `T` has been published; otherwise `false`. |
| `Exists` | `bool Exists(Type t)` | Non-generic overload. Returns `true` if the specified type has been published; otherwise `false`. |
| `Get<T>` | `T Get<T>() where T : class` | Retrieves the published service for interface type `T`. Throws `ArgumentException` if not published. |
| `Clear<T>` | `void Clear<T>() where T : class` | Unpublishes the service for interface type `T`. Silently does nothing if the type is not