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

Commit 0c180c7

Browse files
committed
Remove all warnings + deprecated usages
1 parent f400bfb commit 0c180c7

24 files changed

+36
-43
lines changed

src/ServiceStack.Redis/Generic/RedisTypedPipeline.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ protected void Execute()
5353
{
5454
foreach (var queuedCommand in QueuedCommands)
5555
{
56-
var cmd = queuedCommand as QueuedRedisTypedCommand<T>;
57-
if (cmd != null)
56+
if (queuedCommand is QueuedRedisTypedCommand<T> cmd)
5857
cmd.Execute(RedisClient);
5958
}
6059
}
6160

62-
public bool Replay()
61+
public virtual bool Replay()
6362
{
6463
RedisClient.Pipeline = this;
6564
Execute();
@@ -72,7 +71,7 @@ protected void ClosePipeline()
7271
RedisClient.EndPipeline();
7372
}
7473

75-
public void Dispose()
74+
public virtual void Dispose()
7675
{
7776
ClosePipeline();
7877
}

src/ServiceStack.Redis/Generic/RedisTypedTransaction.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,9 @@ public bool Commit()
120120
private void handleMultiDataResultCount(int count)
121121
{
122122
if (count != _numCommands)
123-
throw new InvalidOperationException(string.Format(
124-
"Invalid results received from 'EXEC', expected '{0}' received '{1}'"
125-
+ "\nWarning: Transaction was committed",
126-
_numCommands, count));
123+
throw new InvalidOperationException(
124+
$"Invalid results received from 'EXEC', expected '{_numCommands}' received '{count}'" +
125+
"\nWarning: Transaction was committed");
127126
}
128127

129128
public void Rollback()
@@ -135,7 +134,7 @@ public void Rollback()
135134
RedisClient.ClearTypeIdsRegisteredDuringPipeline();
136135
}
137136

138-
public bool Replay()
137+
public override bool Replay()
139138
{
140139
bool rc = true;
141140
try
@@ -163,7 +162,7 @@ public bool Replay()
163162
return rc;
164163
}
165164

166-
public void Dispose()
165+
public override void Dispose()
167166
{
168167
base.Dispose();
169168
if (RedisClient.Transaction == null) return;

src/ServiceStack.Redis/Pipeline/RedisAllPurposePipeline.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected void Execute()
6767
}
6868
}
6969

70-
public bool Replay()
70+
public virtual bool Replay()
7171
{
7272
Init();
7373
Execute();
@@ -80,7 +80,7 @@ protected void ClosePipeline()
8080
RedisClient.EndPipeline();
8181
}
8282

83-
public void Dispose()
83+
public virtual void Dispose()
8484
{
8585
ClosePipeline();
8686
}

src/ServiceStack.Redis/RedisClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ public Dictionary<string, T> GetValuesMap<T>(List<string> keys)
539539
return results;
540540
}
541541

542-
public IRedisSubscription CreateSubscription()
542+
public override IRedisSubscription CreateSubscription()
543543
{
544544
return new RedisSubscription(this);
545545
}

src/ServiceStack.Redis/RedisNativeClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,7 @@ public byte[][] ReceiveMessages()
21332133
return ReadMultiData();
21342134
}
21352135

2136-
public IRedisSubscription CreateSubscription()
2136+
public virtual IRedisSubscription CreateSubscription()
21372137
{
21382138
return new RedisSubscription(this);
21392139
}

src/ServiceStack.Redis/RedisNativeClient_Utils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private void Connect()
127127
userCertificateSelectionCallback: RedisConfig.CertificateSelectionCallback,
128128
encryptionPolicy: EncryptionPolicy.RequireEncryption);
129129
#else
130-
var ctor = typeof(SslStream).GetAllConstructors()
130+
var ctor = typeof(SslStream).GetConstructors()
131131
.First(x => x.GetParameters().Length == 5);
132132

133133
var policyType = AssemblyUtils.FindType("System.Net.Security.EncryptionPolicy");

src/ServiceStack.Redis/Support/OrderedDictionary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +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 = !typeof(ValueType).AssignableFrom(typeof(TValue));
19+
private static readonly bool ValueTypeIsReferenceType = !typeof(ValueType).IsAssignableFrom(typeof(TValue));
2020
private Dictionary<TKey, TValue> dictionary;
2121
private List<KeyValuePair<TKey, TValue>> list;
2222
private readonly IEqualityComparer<TKey> comparer;

src/ServiceStack.Redis/Transaction/RedisTransaction.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void Rollback()
128128
RedisClient.ClearTypeIdsRegisteredDuringPipeline();
129129
}
130130

131-
public bool Replay()
131+
public override bool Replay()
132132
{
133133
bool rc = true;
134134
try
@@ -141,7 +141,7 @@ public bool Replay()
141141
queuedCommand.ProcessResult();
142142
}
143143
}
144-
catch (RedisTransactionFailedException e)
144+
catch (RedisTransactionFailedException)
145145
{
146146
rc = false;
147147
}
@@ -154,7 +154,7 @@ public bool Replay()
154154
return rc;
155155
}
156156

157-
public void Dispose()
157+
public override void Dispose()
158158
{
159159
base.Dispose();
160160
if (RedisClient.Transaction == null) return;

tests/Console.Tests/HashCollectionStressTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ private TOut RetryAction<TOut>(Func<IRedisClient, TOut> action)
272272
return result;
273273
}
274274
}
275-
catch (Exception ex)
275+
catch (Exception)
276276
{
277277

278278
if (i++ < 3)

tests/Console.Tests/HashStressTest.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ public override bool Equals(object obj)
2727
if (obj.GetType() != this.GetType()) return false;
2828
return Equals((DeviceInfo) obj);
2929
}
30+
31+
public override int GetHashCode()
32+
{
33+
return base.GetHashCode();
34+
}
3035
}
3136

3237
public class HashStressTest

0 commit comments

Comments
 (0)