@@ -50,16 +50,14 @@ public record struct RenderArgs<TDocument>
50
50
/// <param name="renderForFind">Value that specifies whether rendering a find operation.</param>
51
51
/// <param name="renderForElemMatch">Value that specifies whether rendering an $elemMatch.</param>
52
52
/// <param name="translationOptions">The translation options.</param>
53
- /// <param name="serializationDomain">//TODO</param>
54
53
public RenderArgs (
55
54
IBsonSerializer < TDocument > documentSerializer ,
56
55
IBsonSerializerRegistry serializerRegistry ,
57
56
PathRenderArgs pathRenderArgs = default ,
58
57
bool renderDollarForm = default ,
59
58
bool renderForFind = false ,
60
59
bool renderForElemMatch = false ,
61
- ExpressionTranslationOptions translationOptions = null ,
62
- IBsonSerializationDomain serializationDomain = null )
60
+ ExpressionTranslationOptions translationOptions = null )
63
61
{
64
62
DocumentSerializer = documentSerializer ;
65
63
PathRenderArgs = pathRenderArgs ;
@@ -68,7 +66,35 @@ public RenderArgs(
68
66
_renderForFind = renderForFind ;
69
67
_renderForElemMatch = renderForElemMatch ;
70
68
_translationOptions = translationOptions ; // can be null
71
- _serializationDomain = serializationDomain ?? BsonSerializer . DefaultSerializationDomain ; //TODO Should we do it like this?
69
+ }
70
+
71
+ /// <summary>
72
+ /// Initializes a new instance of the <see cref="RenderArgs{TDocument}"/> record.
73
+ /// </summary>
74
+ /// <param name="documentSerializer">The document serializer.</param>
75
+ /// <param name="pathRenderArgs">The path render arguments.</param>
76
+ /// <param name="renderDollarForm">Value that specifies whether full dollar for should be rendered.</param>
77
+ /// <param name="renderForFind">Value that specifies whether rendering a find operation.</param>
78
+ /// <param name="renderForElemMatch">Value that specifies whether rendering an $elemMatch.</param>
79
+ /// <param name="translationOptions">The translation options.</param>
80
+ /// <param name="serializationDomain">//TODO</param>
81
+ public RenderArgs (
82
+ IBsonSerializer < TDocument > documentSerializer ,
83
+ IBsonSerializationDomain serializationDomain ,
84
+ PathRenderArgs pathRenderArgs = default ,
85
+ bool renderDollarForm = default ,
86
+ bool renderForFind = false ,
87
+ bool renderForElemMatch = false ,
88
+ ExpressionTranslationOptions translationOptions = null )
89
+ {
90
+ DocumentSerializer = documentSerializer ;
91
+ PathRenderArgs = pathRenderArgs ;
92
+ RenderDollarForm = renderDollarForm ;
93
+ _serializationDomain = serializationDomain ?? BsonSerializer . DefaultSerializationDomain ;
94
+ _renderForFind = renderForFind ;
95
+ _renderForElemMatch = renderForElemMatch ;
96
+ _translationOptions = translationOptions ; // can be null
97
+ SerializerRegistry = _serializationDomain . SerializerRegistry ;
72
98
}
73
99
74
100
/// <summary>
@@ -142,6 +168,6 @@ public readonly IBsonSerializer<T> GetSerializer<T>() =>
142
168
/// A new RenderArgs{TNewDocument} instance.
143
169
/// </returns>
144
170
public readonly RenderArgs < TNewDocument > WithNewDocumentType < TNewDocument > ( IBsonSerializer < TNewDocument > serializer ) =>
145
- new ( serializer , _serializerRegistry , _pathRenderArgs , _renderDollarForm , _renderForFind , _renderForElemMatch , _translationOptions , _serializationDomain ) ;
171
+ new ( serializer , _serializationDomain , _pathRenderArgs , _renderDollarForm , _renderForFind , _renderForElemMatch , _translationOptions ) ;
146
172
}
147
173
}
0 commit comments