Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 1870e73

Browse files
committed
Make same codebase for .NET Core and .NET projects
1 parent c5da62c commit 1870e73

File tree

4 files changed

+6
-19
lines changed

4 files changed

+6
-19
lines changed

src/ServiceStack.Redis/RedisNativeClient_Utils.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,8 @@ private void Connect()
120120
}
121121
else
122122
{
123-
#if NETSTANDARD1_3
124-
var ctor = typeof(SslStream).GetTypeInfo().DeclaredConstructors
125-
.First(x => x.GetParameters().Length == 5);
126-
#else
127-
var ctor = typeof(SslStream).GetConstructors()
123+
var ctor = typeof(SslStream).GetAllConstructors()
128124
.First(x => x.GetParameters().Length == 5);
129-
#endif
130125

131126
var policyType = AssemblyUtils.FindType("System.Net.Security.EncryptionPolicy");
132127
var policyValue = Enum.Parse(policyType, "RequireEncryption");

src/ServiceStack.Redis/RedisSentinel.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,10 @@ public IRedisClientsManager Start()
177177
.ToArray();
178178

179179
var sentinelWorker = GetValidSentinelWorker();
180-
#if NETSTANDARD1_3
180+
181181
if (this.RedisManager == null || sentinelWorker == null)
182182
throw new Exception("Unable to resolve sentinels!");
183-
#else
184-
if (this.RedisManager == null || sentinelWorker == null)
185-
throw new ApplicationException("Unable to resolve sentinels!");
186-
#endif
183+
187184
return this.RedisManager;
188185
}
189186
}

src/ServiceStack.Redis/Support/OptimizedObjectSerializer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ SerializedObjectWrapper SerializeToWrapper(object value)
123123

124124
default:
125125
#if NETSTANDARD1_3
126-
data = new byte[0];
126+
data = new byte[0];
127127
length = 0;
128128
#else
129129
using (var ms = new MemoryStream())
@@ -232,7 +232,7 @@ object Unwrap(SerializedObjectWrapper item)
232232
using (var ms = new MemoryStream(data, offset, count))
233233
{
234234
#if NETSTANDARD1_3
235-
return null;
235+
return null;
236236
#else
237237
return bf.Deserialize(ms);
238238
#endif

src/ServiceStack.Redis/Support/OrderedDictionary.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ public class OrderedDictionary<TKey, TValue> : IOrderedDictionary<TKey, TValue>
1616

1717
private static readonly string KeyTypeName = typeof(TKey).FullName;
1818
private static readonly string ValueTypeName = typeof(TValue).FullName;
19-
private static readonly bool ValueTypeIsReferenceType =
20-
#if NETSTANDARD1_3
21-
!typeof(ValueType).GetTypeInfo().IsAssignableFrom(typeof(TValue).GetTypeInfo());
22-
#else
23-
!typeof(ValueType).IsAssignableFrom(typeof(TValue));
24-
#endif
19+
private static readonly bool ValueTypeIsReferenceType = !typeof(ValueType).AssignableFrom(typeof(TValue));
2520
private Dictionary<TKey, TValue> dictionary;
2621
private List<KeyValuePair<TKey, TValue>> list;
2722
private readonly IEqualityComparer<TKey> comparer;

0 commit comments

Comments
 (0)