From cd60f5826bfd70ab286a63088bf4153f7efd75e4 Mon Sep 17 00:00:00 2001 From: James Kovacs Date: Tue, 8 Mar 2022 18:06:36 -0700 Subject: [PATCH] CSHARP-4089: Move TranslationContextData to be internal. (#748) --- .../AggregateExpressionDefinition.cs | 10 +++++-- .../Translators/TranslationContextData.cs | 28 +------------------ 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/MongoDB.Driver/AggregateExpressionDefinition.cs b/src/MongoDB.Driver/AggregateExpressionDefinition.cs index be0593e9407..7bc36877946 100644 --- a/src/MongoDB.Driver/AggregateExpressionDefinition.cs +++ b/src/MongoDB.Driver/AggregateExpressionDefinition.cs @@ -124,11 +124,15 @@ public sealed class ExpressionAggregateExpressionDefinition : /// /// The expression. /// The translation options. - /// Any optional data for the TranslationContext. - public ExpressionAggregateExpressionDefinition( + public ExpressionAggregateExpressionDefinition(Expression> expression, ExpressionTranslationOptions translationOptions) + : this(expression, translationOptions, null) + { + } + + internal ExpressionAggregateExpressionDefinition( Expression> expression, ExpressionTranslationOptions translationOptions, - TranslationContextData contextData = null) + TranslationContextData contextData) { _expression = Ensure.IsNotNull(expression, nameof(expression)); _translationOptions = translationOptions; // can be null diff --git a/src/MongoDB.Driver/Linq/Linq3Implementation/Translators/TranslationContextData.cs b/src/MongoDB.Driver/Linq/Linq3Implementation/Translators/TranslationContextData.cs index e5acf3b5c3d..d2b3faef80a 100644 --- a/src/MongoDB.Driver/Linq/Linq3Implementation/Translators/TranslationContextData.cs +++ b/src/MongoDB.Driver/Linq/Linq3Implementation/Translators/TranslationContextData.cs @@ -18,16 +18,10 @@ namespace MongoDB.Driver.Linq.Linq3Implementation.Translators { - /// - /// Represents arbitrary data for a LINQ3 translation context. - /// - public sealed class TranslationContextData + internal sealed class TranslationContextData { private readonly Dictionary _data; - /// - /// Initializes a new instance of a TranslationContextData. - /// public TranslationContextData() : this(new Dictionary()) { @@ -38,36 +32,16 @@ private TranslationContextData(Dictionary data) _data = Ensure.IsNotNull(data, nameof(data)); } - /// - /// Gets a value. - /// - /// The type of the value. - /// The key. - /// The value. public TValue GetValue(string key) { return (TValue)_data[key]; } - /// - /// Gets a value or a default value if they key is not present. - /// - /// The type of the value. - /// The key. - /// The default value. - /// The value. public TValue GetValueOrDefault(string key, TValue defaultValue) { return _data.TryGetValue(key, out var value) ? (TValue)value : defaultValue; } - /// - /// Returns a new TranslationContextData with an additional value. - /// - /// The type of the value. - /// The key. - /// The value. - /// A new TranslationContextData with an additional value public TranslationContextData With(string key, TValue value) { var clonedData = new Dictionary(_data);