Skip to content

Commit 1eb4229

Browse files
committed
Switch back to previous CSharp syntax style
1 parent de777fe commit 1eb4229

File tree

5 files changed

+32
-23
lines changed

5 files changed

+32
-23
lines changed

src/NServiceBus.Storage.MongoDB.AcceptanceTests/When_custom_provider_registered.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,24 @@ public Task Handle(StartSaga1 message, IMessageHandlerContext context)
5555

5656
public class CustomProvider(Context testContext) : IMongoClientProvider
5757
{
58-
[field: AllowNull, MaybeNull]
5958
public IMongoClient Client
6059
{
6160
get
6261
{
63-
if (field is not null)
62+
if (client is not null)
6463
{
65-
return field;
64+
return client;
6665
}
6766

6867
var containerConnectionString = Environment.GetEnvironmentVariable("NServiceBusStorageMongoDB_ConnectionString");
6968

70-
field = string.IsNullOrWhiteSpace(containerConnectionString) ? new MongoClient() : new MongoClient(containerConnectionString);
69+
client = string.IsNullOrWhiteSpace(containerConnectionString) ? new MongoClient() : new MongoClient(containerConnectionString);
7170
testContext.ProviderWasCalled = true;
72-
return field;
71+
return client;
7372
}
7473
}
74+
75+
IMongoClient? client;
7576
}
7677

7778
public class JustASagaData : ContainSagaData
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace NServiceBus.Storage.MongoDB.Tests;
1+
#nullable enable
2+
3+
namespace NServiceBus.Storage.MongoDB.Tests;
24

35
using System;
46
using global::MongoDB.Driver;
@@ -9,9 +11,9 @@ public static IMongoClient Client
911
{
1012
get
1113
{
12-
if (field != null)
14+
if (client != null)
1315
{
14-
return field;
16+
return client;
1517
}
1618

1719
MongoPersistence.SafeRegisterDefaultGuidSerializer();
@@ -20,11 +22,13 @@ public static IMongoClient Client
2022
var containerConnectionString =
2123
Environment.GetEnvironmentVariable("NServiceBusStorageMongoDB_ConnectionString");
2224

23-
field = string.IsNullOrWhiteSpace(containerConnectionString)
25+
client = string.IsNullOrWhiteSpace(containerConnectionString)
2426
? new MongoClient()
2527
: new MongoClient(containerConnectionString);
2628

27-
return field;
29+
return client;
2830
}
2931
}
32+
33+
static IMongoClient? client;
3034
}

src/NServiceBus.Storage.MongoDB.Tests/Sagas/SagaTestsConfiguration.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,24 @@ public SagaMetadataCollection SagaMetadataCollection
2020
{
2121
get
2222
{
23-
if (field != null)
23+
if (sagaMetadataCollection != null)
2424
{
25-
return field;
25+
return sagaMetadataCollection;
2626
}
2727

2828
var sagaTypes = Assembly.GetExecutingAssembly().GetTypes().Where(t =>
2929
typeof(Saga).IsAssignableFrom(t) || typeof(IFinder).IsAssignableFrom(t)).ToArray();
30-
field = new SagaMetadataCollection();
31-
field.Initialize(sagaTypes);
30+
sagaMetadataCollection = new SagaMetadataCollection();
31+
sagaMetadataCollection.Initialize(sagaTypes);
3232

33-
return field;
33+
return sagaMetadataCollection;
3434
}
3535

36-
set;
36+
set => sagaMetadataCollection = value;
3737
}
3838

39+
SagaMetadataCollection sagaMetadataCollection;
40+
3941
readonly MemberMapCache memberMapCache;
4042

4143
public SagaTestsConfiguration(string versionElementName, Func<Type, string> collectionNamingConvention,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
namespace NServiceBus.Storage.MongoDB;
22

3-
using System.Diagnostics.CodeAnalysis;
43
using global::MongoDB.Driver;
54

65
sealed class DefaultMongoClientProvider : IMongoClientProvider
76
{
8-
[field: AllowNull, MaybeNull]
97
public IMongoClient Client
108
{
119
get
1210
{
13-
field ??= new MongoClient();
14-
return field;
11+
client ??= new MongoClient();
12+
return client;
1513
}
1614
}
15+
16+
MongoClient? client;
1717
}

src/NServiceBus.Storage.MongoDB/Outbox/OutboxPersistenceConfiguration.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ sealed class OutboxPersistenceConfiguration
66
{
77
public TimeSpan TimeToKeepDeduplicationData
88
{
9-
get => field;
9+
get => timeToKeepDeduplicationData;
1010
set
1111
{
1212
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(value, TimeSpan.Zero);
1313

1414
var seconds = Math.Ceiling(value.TotalSeconds);
15-
field = TimeSpan.FromSeconds(seconds);
15+
timeToKeepDeduplicationData = TimeSpan.FromSeconds(seconds);
1616
}
17-
} = TimeSpan.FromDays(7);
17+
}
1818

1919
public bool ReadFallbackEnabled { get; set; } = true;
2020

2121
public string PartitionKey { get; set; } = null!; // will be set by defaults
22+
23+
TimeSpan timeToKeepDeduplicationData = TimeSpan.FromDays(7);
2224
}

0 commit comments

Comments
 (0)