Class AppDomainSyncRootRegistry
Provides a centralized, thread-safe registry of SyncRoot objects keyed by symbolic names. Each key maps to exactly one synchronization object for the lifetime of the application domain.
Inheritance
Inherited Members
Namespace: WizardWrx
Assembly: WizardWrx.Core.dll
Syntax
public static class AppDomainSyncRootRegistry
Remarks
The canonical key format for typed overloads is:
{AssemblyQualifiedTypeName}.{MethodName}
Use the typed overloads to get strict metadata validation. The raw-key overload is provided for advanced scenarios where the caller constructs a collision-proof key manually.
Properties
| Improve this Doc View SourceRegisteredSyncRoots
Enumerate all registered synchronization roots and their keys.
Declaration
public static IReadOnlyDictionary<string, SyncRoot> RegisteredSyncRoots { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyDictionary<System.String, SyncRoot> |
Remarks
The returned dictionary is a snapshot view of the current registry contents. It is intended for diagnostics, logging, and debugging.
Methods
| Improve this Doc View SourceGetSyncRoot(String)
Retrieve the SyncRoot associated with the specified raw key. This overload does not associate explicit type/method metadata with the key; it is the caller's responsibility to ensure that the key is collision-free and intention-revealing.
Declaration
public static SyncRoot GetSyncRoot(string pstrRawKey)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | pstrRawKey | This System.String represents a stable, unique identifier for the lock. No metadata validation is performed for this overload. |
Returns
| Type | Description |
|---|---|
| SyncRoot | A reference to the SyncRoot associated with the specified key. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | Thrown if |
GetSyncRoot(Type, String)
Construct a canonical synchronization key from a type and method name, then retrieve the associated SyncRoot. This overload enforces strict metadata consistency for the key.
Declaration
public static SyncRoot GetSyncRoot(Type ptypDeclaringType, string pstrMethodName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | ptypDeclaringType | The declaring System.Type for the method being synchronized. |
| System.String | pstrMethodName | This System.String represents the name of the method whose execution must be serialized. |
Returns
| Type | Description |
|---|---|
| SyncRoot | If it succeeds, the return value is a reference to the SyncRoot associated with the constructed key. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | An ArgumentNullException Exception is thrown if
|
| System.ArgumentException | An ArgumentException Exception is thrown if
|
| System.InvalidOperationException | An InvalidOperationException Exception is thrown if the constructed key is already associated with a different type or method name than the one supplied. |
GetSyncRoot<T>(String)
Convenience overload that infers the declaring type from the generic type parameter and the method name from the caller context.
Declaration
public static SyncRoot GetSyncRoot<T>(string pstrCallerMemberName = "")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | pstrCallerMemberName | The name of the calling member, supplied automatically by the compiler. |
Returns
| Type | Description |
|---|---|
| SyncRoot | A reference to the SyncRoot associated with the constructed key. |
Type Parameters
| Name | Description |
|---|---|
| T | The declaring type for the method being synchronized. |