// Copyright (c) Microsoft. All rights reserved. namespace Microsoft.Agents.Workflows; /// /// Extensions methods for creating Configured objects /// public static class ConfigurationExtensions { /// /// Creates a new configuration that treats the subject as its base type, allowing configuration to be applied at /// the parent type level. /// /// The type of the original subject being configured. Must inherit from or implement TParent. /// The base type or interface to which the configuration will be upcast. /// The existing configuration for the subject type to be upcast to its parent type. Cannot be null. /// A new instance that applies the original configuration logic to the parent type. public static Configured Super(this Configured configured) where TSubject : TParent => new(async config => await configured.FactoryAsync(config).ConfigureAwait(false), configured.Id, configured.Raw); /// /// Creates a new configuration that treats the subject as its base type, allowing configuration to be applied at /// the parent type level. /// /// The type of the original subject being configured. Must inherit from or implement TParent. /// The base type or interface to which the configuration will be upcast. /// The type of configuration options for the original subject being configured. /// The existing configuration for the subject type to be upcast to its parent type. Cannot be null. /// A new instance that applies the original configuration logic to the parent type. public static Configured Super(this Configured configured) where TSubject : TParent => configured.Memoize().Super(); }