File tree 4 files changed +33
-31
lines changed
Ark.Tools.AspNetCore.MessagePack
4 files changed +33
-31
lines changed Original file line number Diff line number Diff line change @@ -18,21 +18,20 @@ public class LZ4MessagePackInputFormatter : InputFormatter
18
18
readonly MessagePackSerializerOptions _options ;
19
19
20
20
public LZ4MessagePackInputFormatter ( )
21
- : this ( null )
21
+ : this ( MessagePackSerializer . DefaultOptions )
22
22
{
23
23
}
24
24
25
- public LZ4MessagePackInputFormatter ( IFormatterResolver ? resolver )
25
+ public LZ4MessagePackInputFormatter ( IFormatterResolver resolver )
26
+ : this ( MessagePackSerializer . DefaultOptions . WithResolver ( resolver ) )
26
27
{
27
- SupportedMediaTypes . Add ( ContentType ) ;
28
+ }
28
29
29
- if ( resolver == null )
30
- _options = MessagePackSerializer . DefaultOptions ;
31
- else
32
- _options = MessagePackSerializer . DefaultOptions . WithResolver ( resolver ) ;
30
+ public LZ4MessagePackInputFormatter ( MessagePackSerializerOptions options )
31
+ {
32
+ SupportedMediaTypes . Add ( ContentType ) ;
33
33
34
- _options = _options . WithCompression ( MessagePackCompression . Lz4Block ) ;
35
- _options = _options . WithSecurity ( MessagePackSecurity . UntrustedData ) ;
34
+ _options = options . WithCompression ( MessagePackCompression . Lz4Block ) ;
36
35
}
37
36
38
37
protected override bool CanReadType ( Type type )
Original file line number Diff line number Diff line change @@ -16,20 +16,20 @@ public class LZ4MessagePackOutputFormatter : OutputFormatter
16
16
readonly MessagePackSerializerOptions _options ;
17
17
18
18
public LZ4MessagePackOutputFormatter ( )
19
- : this ( null )
19
+ : this ( MessagePackSerializer . DefaultOptions )
20
20
{
21
21
}
22
22
23
- public LZ4MessagePackOutputFormatter ( IFormatterResolver ? resolver )
23
+ public LZ4MessagePackOutputFormatter ( IFormatterResolver resolver )
24
+ : this ( MessagePackSerializer . DefaultOptions . WithResolver ( resolver ) )
24
25
{
25
- SupportedMediaTypes . Add ( _contentType ) ;
26
+ }
26
27
27
- if ( resolver == null )
28
- _options = MessagePackSerializer . DefaultOptions ;
29
- else
30
- _options = MessagePackSerializer . DefaultOptions . WithResolver ( resolver ) ;
28
+ public LZ4MessagePackOutputFormatter ( MessagePackSerializerOptions options )
29
+ {
30
+ SupportedMediaTypes . Add ( _contentType ) ;
31
31
32
- _options = _options . WithCompression ( MessagePackCompression . Lz4Block ) ;
32
+ _options = options . WithCompression ( MessagePackCompression . Lz4Block ) ;
33
33
}
34
34
35
35
protected override bool CanWriteType ( Type ? type )
Original file line number Diff line number Diff line change @@ -18,20 +18,20 @@ public class MessagePackInputFormatter : InputFormatter
18
18
readonly MessagePackSerializerOptions _options ;
19
19
20
20
public MessagePackInputFormatter ( )
21
- : this ( null )
21
+ : this ( MessagePackSerializer . DefaultOptions )
22
22
{
23
23
}
24
24
25
- public MessagePackInputFormatter ( IFormatterResolver ? resolver )
25
+ public MessagePackInputFormatter ( IFormatterResolver resolver )
26
+ : this ( MessagePackSerializer . DefaultOptions . WithResolver ( resolver ) )
26
27
{
27
- SupportedMediaTypes . Add ( ContentType ) ;
28
+ }
28
29
29
- if ( resolver == null )
30
- _options = MessagePackSerializer . DefaultOptions ;
31
- else
32
- _options = MessagePackSerializer . DefaultOptions . WithResolver ( resolver ) ;
30
+ public MessagePackInputFormatter ( MessagePackSerializerOptions options )
31
+ {
32
+ SupportedMediaTypes . Add ( ContentType ) ;
33
33
34
- _options = _options . WithSecurity ( MessagePackSecurity . UntrustedData ) ;
34
+ _options = options ;
35
35
}
36
36
37
37
protected override bool CanReadType ( Type type )
Original file line number Diff line number Diff line change @@ -16,17 +16,20 @@ public class MessagePackOutputFormatter : OutputFormatter
16
16
readonly MessagePackSerializerOptions _options ;
17
17
18
18
public MessagePackOutputFormatter ( )
19
- : this ( null )
19
+ : this ( MessagePackSerializer . DefaultOptions )
20
20
{
21
21
}
22
- public MessagePackOutputFormatter ( IFormatterResolver ? resolver )
22
+
23
+ public MessagePackOutputFormatter ( IFormatterResolver resolver )
24
+ : this ( MessagePackSerializer . DefaultOptions . WithResolver ( resolver ) )
25
+ {
26
+ }
27
+
28
+ public MessagePackOutputFormatter ( MessagePackSerializerOptions options )
23
29
{
24
30
SupportedMediaTypes . Add ( _contentType ) ;
25
31
26
- if ( resolver == null )
27
- _options = MessagePackSerializer . DefaultOptions ;
28
- else
29
- _options = MessagePackSerializer . DefaultOptions . WithResolver ( resolver ) ;
32
+ _options = options ;
30
33
}
31
34
32
35
protected override bool CanWriteType ( Type ? type )
You can’t perform that action at this time.
0 commit comments