18
18
19
19
namespace MongoDB . Driver . Linq . Linq3Implementation . Translators
20
20
{
21
- /// <summary>
22
- /// Represents arbitrary data for a LINQ3 translation context.
23
- /// </summary>
24
- public sealed class TranslationContextData
21
+ internal sealed class TranslationContextData
25
22
{
26
23
private readonly Dictionary < string , object > _data ;
27
24
28
- /// <summary>
29
- /// Initializes a new instance of a TranslationContextData.
30
- /// </summary>
31
25
public TranslationContextData ( )
32
26
: this ( new Dictionary < string , object > ( ) )
33
27
{
@@ -38,36 +32,16 @@ private TranslationContextData(Dictionary<string, object> data)
38
32
_data = Ensure . IsNotNull ( data , nameof ( data ) ) ;
39
33
}
40
34
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>
47
35
public TValue GetValue < TValue > ( string key )
48
36
{
49
37
return ( TValue ) _data [ key ] ;
50
38
}
51
39
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>
59
40
public TValue GetValueOrDefault < TValue > ( string key , TValue defaultValue )
60
41
{
61
42
return _data . TryGetValue ( key , out var value ) ? ( TValue ) value : defaultValue ;
62
43
}
63
44
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>
71
45
public TranslationContextData With < TValue > ( string key , TValue value )
72
46
{
73
47
var clonedData = new Dictionary < string , object > ( _data ) ;
0 commit comments