File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/NHibernate.Test/Async/NHSpecificTest/NH2898 Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,31 @@ namespace NHibernate.Test.NHSpecificTest.NH2898
23
23
public partial class BinaryFormatterCache : CacheBase
24
24
{
25
25
26
+ public override Task < object > GetAsync ( object key , CancellationToken cancellationToken )
27
+ {
28
+ try
29
+ {
30
+ var entry = _hashtable [ key ] as byte [ ] ;
31
+ if ( entry == null )
32
+ return Task . FromResult < object > ( null ) ;
33
+
34
+ var fmt = new BinaryFormatter
35
+ {
36
+ #if ! NETFX
37
+ SurrogateSelector = new SerializationHelper . SurrogateSelector ( )
38
+ #endif
39
+ } ;
40
+ using ( var stream = new MemoryStream ( entry ) )
41
+ {
42
+ return Task . FromResult < object > ( fmt . Deserialize ( stream ) ) ;
43
+ }
44
+ }
45
+ catch ( System . Exception ex )
46
+ {
47
+ return Task . FromException < object > ( ex ) ;
48
+ }
49
+ }
50
+
26
51
public override Task PutAsync ( object key , object value , CancellationToken cancellationToken )
27
52
{
28
53
try
You can’t perform that action at this time.
0 commit comments