Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Microsoft.FeatureManagement/FeatureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -847,10 +847,11 @@ private Variant GetVariantFromVariantDefinition(VariantDefinition variantDefinit
variantConfiguration = variantDefinition.ConfigurationValue;
}

return new Variant()
return new Variant
{
Name = variantDefinition.Name,
Configuration = variantConfiguration
Configuration = variantConfiguration,
ConfigurationObject = variantDefinition.ConfigurationObject,
};
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/Microsoft.FeatureManagement/Variant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,11 @@ public class Variant
/// The configuration of the variant.
/// </summary>
public IConfigurationSection Configuration { get; set; }

/// <summary>
/// The configuration of the variant.
/// When set, variants should prefer this over <see cref="Configuration"/>.
/// </summary>
public object ConfigurationObject { get; set; }
}
}
8 changes: 8 additions & 0 deletions src/Microsoft.FeatureManagement/VariantDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ public class VariantDefinition
/// </summary>
public IConfigurationSection ConfigurationValue { get; set; }

/// <summary>
/// A configuration object that can be used as an alternative to <see cref="ConfigurationValue"/>.
/// Custom <see cref="IFeatureDefinitionProvider"/> implementations can populate this property directly
/// instead of constructing an <see cref="IConfiguration"/> instance.
/// When set, variants should prefer this over <see cref="ConfigurationValue"/>.
/// </summary>
public object ConfigurationObject { get; set; }

/// <summary>
/// Overrides the state of the feature if this variant has been assigned.
/// </summary>
Expand Down