@@ -12,14 +12,14 @@ internal class Formatter : MediaTypeFormatter
12
12
{
13
13
private Func < Type , bool > _canReadType ;
14
14
private Func < Type , bool > _canWriteType ;
15
- private Func < Type , Stream , HttpContent , IFormatterLogger , Task < object > > _readFromStream ;
16
- private Func < Type , object , Stream , HttpContent , TransportContext , CancellationToken , Task > _writeToStream ;
15
+ private Func < ReadFromStreamArgs , Task < object > > _readFromStream ;
16
+ private Func < WriteToStreamArgs , Task > _writeToStream ;
17
17
18
18
public Formatter (
19
19
Func < Type , bool > canReadType ,
20
20
Func < Type , bool > canWriteType ,
21
- Func < Type , Stream , HttpContent , IFormatterLogger , Task < object > > readFromStream ,
22
- Func < Type , object , Stream , HttpContent , TransportContext , CancellationToken , Task > writeToStream
21
+ Func < ReadFromStreamArgs , Task < object > > readFromStream ,
22
+ Func < WriteToStreamArgs , Task > writeToStream
23
23
)
24
24
{
25
25
_canReadType = canReadType ;
@@ -30,14 +30,13 @@ Func<Type, object, Stream, HttpContent, TransportContext, CancellationToken, Tas
30
30
31
31
public override Task < object > ReadFromStreamAsync ( Type type , Stream readStream , HttpContent content , IFormatterLogger formatterLogger )
32
32
{
33
- return _readFromStream ( type , readStream , content , formatterLogger ) ;
33
+ return _readFromStream ( new ReadFromStreamArgs ( type , readStream , content , formatterLogger ) ) ;
34
34
}
35
35
36
-
37
36
public override Task WriteToStreamAsync ( Type type , object value , Stream writeStream , HttpContent content ,
38
37
TransportContext transportContext , CancellationToken cancellationToken )
39
38
{
40
- return _writeToStream ( type , value , writeStream , content , transportContext , cancellationToken ) ;
39
+ return _writeToStream ( new WriteToStreamArgs ( type , value , writeStream , content , transportContext , cancellationToken ) ) ;
41
40
}
42
41
43
42
public override bool CanReadType ( Type type )
0 commit comments