#nullable enable
using System;
using System.Collections.Generic;
namespace Svrnty.CQRS.Configuration;
///
/// Configuration for CQRS services and endpoints.
/// Supports extension by third-party packages through generic configuration storage.
///
public class CqrsConfiguration
{
private readonly Dictionary _configurations = new();
///
/// Sets a configuration object for a specific type
///
public void SetConfiguration(T config) where T : class
{
_configurations[typeof(T)] = config;
}
///
/// Gets a configuration object for a specific type
///
public T? GetConfiguration() where T : class
{
return _configurations.TryGetValue(typeof(T), out var config) ? config as T : null;
}
///
/// Checks if a configuration exists for a specific type
///
public bool HasConfiguration() where T : class
{
return _configurations.ContainsKey(typeof(T));
}
}