1818
1919namespace 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