Skip to content

Commit cd60f58

Browse files
authored
CSHARP-4089: Move TranslationContextData to be internal. (#748)
1 parent 89ea0e5 commit cd60f58

File tree

2 files changed

+8
-30
lines changed

2 files changed

+8
-30
lines changed

src/MongoDB.Driver/AggregateExpressionDefinition.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,15 @@ public sealed class ExpressionAggregateExpressionDefinition<TSource, TResult> :
124124
/// </summary>
125125
/// <param name="expression">The expression.</param>
126126
/// <param name="translationOptions">The translation options.</param>
127-
/// <param name="contextData">Any optional data for the TranslationContext.</param>
128-
public ExpressionAggregateExpressionDefinition(
127+
public ExpressionAggregateExpressionDefinition(Expression<Func<TSource, TResult>> expression, ExpressionTranslationOptions translationOptions)
128+
: this(expression, translationOptions, null)
129+
{
130+
}
131+
132+
internal ExpressionAggregateExpressionDefinition(
129133
Expression<Func<TSource, TResult>> expression,
130134
ExpressionTranslationOptions translationOptions,
131-
TranslationContextData contextData = null)
135+
TranslationContextData contextData)
132136
{
133137
_expression = Ensure.IsNotNull(expression, nameof(expression));
134138
_translationOptions = translationOptions; // can be null

src/MongoDB.Driver/Linq/Linq3Implementation/Translators/TranslationContextData.cs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,10 @@
1818

1919
namespace MongoDB.Driver.Linq.Linq3Implementation.Translators
2020
{
21-
/// <summary>
22-
/// Represents arbitrary data for a LINQ3 translation context.
23-
/// </summary>
24-
public sealed class TranslationContextData
21+
internal sealed class TranslationContextData
2522
{
2623
private readonly Dictionary<string, object> _data;
2724

28-
/// <summary>
29-
/// Initializes a new instance of a TranslationContextData.
30-
/// </summary>
3125
public TranslationContextData()
3226
: this(new Dictionary<string, object>())
3327
{
@@ -38,36 +32,16 @@ private TranslationContextData(Dictionary<string, object> data)
3832
_data = Ensure.IsNotNull(data, nameof(data));
3933
}
4034

41-
/// <summary>
42-
/// Gets a value.
43-
/// </summary>
44-
/// <typeparam name="TValue">The type of the value.</typeparam>
45-
/// <param name="key">The key.</param>
46-
/// <returns>The value.</returns>
4735
public TValue GetValue<TValue>(string key)
4836
{
4937
return (TValue)_data[key];
5038
}
5139

52-
/// <summary>
53-
/// Gets a value or a default value if they key is not present.
54-
/// </summary>
55-
/// <typeparam name="TValue">The type of the value.</typeparam>
56-
/// <param name="key">The key.</param>
57-
/// <param name="defaultValue">The default value.</param>
58-
/// <returns>The value.</returns>
5940
public TValue GetValueOrDefault<TValue>(string key, TValue defaultValue)
6041
{
6142
return _data.TryGetValue(key, out var value) ? (TValue)value : defaultValue;
6243
}
6344

64-
/// <summary>
65-
/// Returns a new TranslationContextData with an additional value.
66-
/// </summary>
67-
/// <typeparam name="TValue">The type of the value.</typeparam>
68-
/// <param name="key">The key.</param>
69-
/// <param name="value">The value.</param>
70-
/// <returns>A new TranslationContextData with an additional value</returns>
7145
public TranslationContextData With<TValue>(string key, TValue value)
7246
{
7347
var clonedData = new Dictionary<string, object>(_data);

0 commit comments

Comments
 (0)