Skip to content

Commit 9289d29

Browse files
authored
Make StringHelper.GenerateSuffix internal (#3663)
1 parent 038a4c3 commit 9289d29

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/NHibernate.Test/Async/NHSpecificTest/NH2898/BinaryFormatterCache.cs

+25
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,31 @@ namespace NHibernate.Test.NHSpecificTest.NH2898
2323
public partial class BinaryFormatterCache : CacheBase
2424
{
2525

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+
2651
public override Task PutAsync(object key, object value, CancellationToken cancellationToken)
2752
{
2853
try

src/NHibernate/Util/StringHelper.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ public static bool IsAnyNewLine(this string str, int index, out int newLineLengt
872872
return false;
873873
}
874874

875-
public static string GenerateSuffix(int index)
875+
internal static string GenerateSuffix(int index)
876876
{
877877
return index switch
878878
{

0 commit comments

Comments
 (0)