Skip to content

Commit a810791

Browse files
committed
Adjust to auto property
1 parent 0cbc6d4 commit a810791

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,16 @@ public int MaxBodySizeToStore
139139
{
140140
get
141141
{
142-
if (maxBodySizeToStore <= 0)
142+
if (field <= 0)
143143
{
144144
logger.LogError("MaxBodySizeToStore settings is invalid, 1 is the minimum value. Defaulting to {MaxBodySizeToStoreDefault}", MaxBodySizeToStoreDefault);
145145
return MaxBodySizeToStoreDefault;
146146
}
147147

148-
return maxBodySizeToStore;
148+
return field;
149149
}
150-
set => maxBodySizeToStore = value;
151-
}
150+
set;
151+
} = SettingsReader.Read(SettingsRootNamespace, "MaxBodySizeToStore", MaxBodySizeToStoreDefault);
152152

153153
public string InstanceName { get; init; } = DEFAULT_INSTANCE_NAME;
154154

@@ -290,9 +290,6 @@ static string Subscope(string address)
290290

291291
// logger is intentionally not static to prevent it from being initialized before LoggingConfigurator.ConfigureLogging has been called
292292
readonly ILogger logger = LoggerUtil.CreateStaticLogger<Settings>();
293-
294-
int maxBodySizeToStore = SettingsReader.Read(SettingsRootNamespace, "MaxBodySizeToStore", MaxBodySizeToStoreDefault);
295-
296293
public const string DEFAULT_INSTANCE_NAME = "Particular.ServiceControl.Audit";
297294
public static readonly SettingsRootNamespace SettingsRootNamespace = new("ServiceControl.Audit");
298295

src/ServiceControl/CompositeViews/Messages/ScatterGatherRemoteOnly.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public abstract class ScatterGatherRemoteOnly<TIn, TOut>(Settings settings, IHtt
1616

1717
public sealed class NoOpStore
1818
{
19-
public static NoOpStore Instance => instance ??= new NoOpStore();
20-
21-
static NoOpStore instance;
19+
public static NoOpStore Instance => field ??= new NoOpStore();
2220
}
2321
}

src/ServiceControl/Infrastructure/Settings/Settings.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,16 @@ public string RootUrl
109109

110110
public string ApiUrl => $"{RootUrl}api";
111111

112-
string _instanceId;
113112
public string InstanceId
114113
{
115114
get
116115
{
117-
if (string.IsNullOrEmpty(_instanceId))
116+
if (string.IsNullOrEmpty(field))
118117
{
119-
_instanceId = InstanceIdGenerator.FromApiUrl(ApiUrl);
118+
field = InstanceIdGenerator.FromApiUrl(ApiUrl);
120119
}
121120

122-
return _instanceId;
121+
return field;
123122
}
124123
}
125124

src/ServiceControl/Recoverability/Retrying/Infrastructure/ErrorQueueNameCache.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@
44

55
class ErrorQueueNameCache
66
{
7-
string resolvedErrorAddress;
8-
97
public string ResolvedErrorAddress
108
{
119
get
1210
{
13-
if (string.IsNullOrEmpty(resolvedErrorAddress))
11+
if (string.IsNullOrEmpty(field))
1412
{
1513
throw new InvalidOperationException($"{nameof(ResolvedErrorAddress)} is not set. Please set it before accessing.");
1614
}
1715

18-
return resolvedErrorAddress;
16+
return field;
1917
}
20-
set => resolvedErrorAddress = value;
18+
set;
2119
}
2220
}

0 commit comments

Comments
 (0)