@@ -50,16 +50,14 @@ public record struct RenderArgs<TDocument>
5050 /// <param name="renderForFind">Value that specifies whether rendering a find operation.</param>
5151 /// <param name="renderForElemMatch">Value that specifies whether rendering an $elemMatch.</param>
5252 /// <param name="translationOptions">The translation options.</param>
53- /// <param name="serializationDomain">//TODO</param>
5453 public RenderArgs (
5554 IBsonSerializer < TDocument > documentSerializer ,
5655 IBsonSerializerRegistry serializerRegistry ,
5756 PathRenderArgs pathRenderArgs = default ,
5857 bool renderDollarForm = default ,
5958 bool renderForFind = false ,
6059 bool renderForElemMatch = false ,
61- ExpressionTranslationOptions translationOptions = null ,
62- IBsonSerializationDomain serializationDomain = null )
60+ ExpressionTranslationOptions translationOptions = null )
6361 {
6462 DocumentSerializer = documentSerializer ;
6563 PathRenderArgs = pathRenderArgs ;
@@ -68,7 +66,35 @@ public RenderArgs(
6866 _renderForFind = renderForFind ;
6967 _renderForElemMatch = renderForElemMatch ;
7068 _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 ;
7298 }
7399
74100 /// <summary>
@@ -142,6 +168,6 @@ public readonly IBsonSerializer<T> GetSerializer<T>() =>
142168 /// A new RenderArgs{TNewDocument} instance.
143169 /// </returns>
144170 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 ) ;
146172 }
147173}
0 commit comments