From a9063d0d52400584868a5628a8a0b9c1f2e168be Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Fri, 1 Sep 2023 11:22:58 +0200 Subject: [PATCH] Requested changes --- .../Evaluation/EvaluateContext.cs | 34 +++++++++---------- .../Models/PercentageOption.cs | 4 +-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/ConfigCatClient/Evaluation/EvaluateContext.cs b/src/ConfigCatClient/Evaluation/EvaluateContext.cs index f99ec213..1aadebb3 100644 --- a/src/ConfigCatClient/Evaluation/EvaluateContext.cs +++ b/src/ConfigCatClient/Evaluation/EvaluateContext.cs @@ -5,6 +5,23 @@ namespace ConfigCat.Client.Evaluation; internal struct EvaluateContext { + public readonly string Key; + public readonly Setting Setting; + public readonly SettingValue DefaultValue; + public readonly User? User; + public readonly IReadOnlyDictionary Settings; + + private IReadOnlyDictionary? userAttributes; + public IReadOnlyDictionary? UserAttributes => this.userAttributes ??= this.User?.GetAllAttributes(); + + private List? visitedFlags; + public List VisitedFlags => this.visitedFlags ??= new List(); + + public bool IsMissingUserObjectLogged; + public bool IsMissingUserObjectAttributeLogged; + + public IndentedTextBuilder? LogBuilder; + public EvaluateContext(string key, Setting setting, SettingValue defaultValue, User? user, IReadOnlyDictionary settings) { this.Key = key; @@ -26,21 +43,4 @@ public EvaluateContext(string key, Setting setting, ref EvaluateContext dependen this.visitedFlags = dependentFlagContext.VisitedFlags; // crucial to use the property here to make sure the list is created! this.LogBuilder = dependentFlagContext.LogBuilder; } - - public readonly string Key; - public readonly Setting Setting; - public readonly SettingValue DefaultValue; - public readonly User? User; - public readonly IReadOnlyDictionary Settings; - - private IReadOnlyDictionary? userAttributes; - public IReadOnlyDictionary? UserAttributes => this.userAttributes ??= this.User?.GetAllAttributes(); - - private List? visitedFlags; - public List VisitedFlags => this.visitedFlags ??= new List(); - - public bool IsMissingUserObjectLogged; - public bool IsMissingUserObjectAttributeLogged; - - public IndentedTextBuilder? LogBuilder; } diff --git a/src/ConfigCatClient/Models/PercentageOption.cs b/src/ConfigCatClient/Models/PercentageOption.cs index ceac8cfd..0ef1d579 100644 --- a/src/ConfigCatClient/Models/PercentageOption.cs +++ b/src/ConfigCatClient/Models/PercentageOption.cs @@ -17,7 +17,7 @@ public interface IPercentageOption : ISettingValueContainer /// /// A number between 0 and 100 that represents a randomly allocated fraction of the users. /// - int Percentage { get; } + byte Percentage { get; } } internal sealed class PercentageOption : SettingValueContainer, IPercentageOption @@ -27,7 +27,7 @@ internal sealed class PercentageOption : SettingValueContainer, IPercentageOptio #else [JsonPropertyName("p")] #endif - public int Percentage { get; set; } + public byte Percentage { get; set; } public override string ToString() {