You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
String.Format("An attempt was made to use a key '{2}' that is outside of the global namespace {0} of database '{1}'",db.GlobalSpace,db.Name,FdbKey.Dump(key))
73
+
$"An attempt was made to use a key '{FdbKey.Dump(key)}' that is outside of the global namespace {db.GlobalSpace} of database '{db.Name}'"
74
74
#else
75
-
String.Format("An attempt was made to use a key that is outside of the global namespace {0} of database '{1}'",db.GlobalSpace,db.Name)
75
+
$"An attempt was made to use a key that is outside of the global namespace {db.GlobalSpace} of database '{db.Name}'"
Copy file name to clipboardExpand all lines: FoundationDB.Client/Fdb.cs
+27-34Lines changed: 27 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -30,16 +30,15 @@ DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
30
30
31
31
namespaceFoundationDB.Client
32
32
{
33
-
usingFoundationDB.Client.Native;
34
-
usingFoundationDB.Client.Utils;
35
-
usingJetBrains.Annotations;
36
33
usingSystem;
37
34
usingSystem.Diagnostics;
38
35
usingSystem.Runtime.CompilerServices;
39
36
usingSystem.Runtime.ExceptionServices;
40
37
usingSystem.Threading;
41
38
usingSystem.Threading.Tasks;
42
39
usingSystemIO=System.IO;
40
+
usingFoundationDB.Client.Native;
41
+
usingJetBrains.Annotations;
43
42
44
43
/// <summary>FoundationDB binding</summary>
45
44
[PublicAPI]
@@ -115,10 +114,7 @@ public static int GetMaxSafeApiVersion()
115
114
116
115
/// <summary>Returns the currently selected API version.</summary>
117
116
/// <remarks>Unless explicitely selected by calling <see cref="UseApiVersion"/> before, the default API version level will be returned</remarks>
118
-
publicstaticintApiVersion
119
-
{
120
-
get{returns_apiVersion;}
121
-
}
117
+
publicstaticintApiVersion=>s_apiVersion;
122
118
123
119
/// <summary>Sets the desired API version of the binding.
124
120
/// The selected version level may affect the availability and behavior or certain features.
@@ -138,14 +134,14 @@ public static void UseApiVersion(int value)
138
134
value=DefaultApiVersion;
139
135
}
140
136
if(s_apiVersion==value)return;//Alreay set to same version... skip it.
141
-
if(s_started)thrownewInvalidOperationException(string.Format("You cannot set API version {0} because version {1} has already been selected",value,s_apiVersion));
137
+
if(s_started)thrownewInvalidOperationException($"You cannot set API version {value} because version {Fdb.s_apiVersion} has already been selected");
142
138
143
139
//note: we don't actually select the version yet, only when Start() is called.
144
140
145
141
intmin=GetMinApiVersion();
146
-
if(value<min)thrownewArgumentException(String.Format("The minimum API version supported by this binding is {0} and the default version is {1}.",min,DefaultApiVersion));
142
+
if(value<min)thrownewArgumentException($"The minimum API version supported by this binding is {min} and the default version is {Fdb.DefaultApiVersion}.");
147
143
intmax=GetMaxApiVersion();
148
-
if(value>max)thrownewArgumentException(String.Format("The maximum API version supported by this binding is {0} and the default version is {1}.",max,DefaultApiVersion));
144
+
if(value>max)thrownewArgumentException($"The maximum API version supported by this binding is {max} and the default version is {Fdb.DefaultApiVersion}.");
149
145
150
146
s_apiVersion=value;
151
147
}
@@ -182,7 +178,7 @@ public static Exception MapToException(FdbError code)
if(Logging.On)Logging.Warning(typeof(Fdb),"StopEventLoop",String.Format("The fdb network thread has not stopped after {0} seconds. Forcing shutdown...",duration.Elapsed.TotalSeconds.ToString("N0")));
275
+
if(Logging.On)Logging.Warning(typeof(Fdb),"StopEventLoop",$"The fdb network thread has not stopped after {duration.Elapsed.TotalSeconds:N0} seconds. Forcing shutdown...");
if(Logging.On)Logging.Warning(typeof(Fdb),"StopEventLoop",String.Format("The fdb network thread failed to stop after more than {0} seconds. Transaction integrity may not be guaranteed.",duration.Elapsed.TotalSeconds.ToString("N0")));
286
+
if(Logging.On)Logging.Warning(typeof(Fdb),"StopEventLoop",$"The fdb network thread failed to stop after more than {duration.Elapsed.TotalSeconds:N0} seconds. Transaction integrity may not be guaranteed.");
if(Logging.On)Logging.Warning(typeof(Fdb),"StopEventLoop",String.Format("The fdb network thread took a long time to stop ({0} seconds).",duration.Elapsed.TotalSeconds.ToString("N0")));
300
+
if(Logging.On)Logging.Warning(typeof(Fdb),"StopEventLoop",$"The fdb network thread took a long time to stop ({duration.Elapsed.TotalSeconds:N0} seconds).");
{// this was requested, or can be explained by the computer shutting down...
331
-
if(Logging.On)Logging.Info(typeof(Fdb),"EventLoop",String.Format("The fdb network thread returned with error code {0}: {1}",err,GetErrorMessage(err)));
327
+
if(Logging.On)Logging.Info(typeof(Fdb),"EventLoop",$"The fdb network thread returned with error code {err}: {GetErrorMessage(err)}");
332
328
}
333
329
else
334
330
{// this was NOT expected !
335
-
if(Logging.On)Logging.Error(typeof(Fdb),"EventLoop",String.Format("The fdb network thread returned with error code {0}: {1}",err,GetErrorMessage(err)));
331
+
if(Logging.On)Logging.Error(typeof(Fdb),"EventLoop",$"The fdb network thread returned with error code {err}: {GetErrorMessage(err)}");
336
332
#if DEBUG
337
333
Console.Error.WriteLine("THE FDB NETWORK EVENT LOOP HAS FAILED!");
if(Logging.On)Logging.Error(typeof(Fdb),"Start",String.Format("Failed to fdb API version {0}: {1}",apiVersion,err));
598
+
if(Logging.On)Logging.Error(typeof(Fdb),"Start",$"Failed to fdb API version {apiVersion}: {err}");
606
599
607
600
switch(err)
608
601
{
609
602
caseFdbError.ApiVersionNotSupported:
610
603
{// bad version was selected ?
611
604
// note: we already bound check the values before, so that means that fdb_c.dll is either an older version or an incompatible new version.
612
-
thrownewFdbException(err,String.Format("The API version {0} is not supported by the FoundationDB client library (fdb_c.dll) installed on this system. The binding only supports versions {1} to {2}. You either need to upgrade the .NET binding or the FoundationDB client library to a newer version.",apiVersion,GetMinApiVersion(),GetMaxApiVersion()));
605
+
thrownewFdbException(err,$"The API version {apiVersion} is not supported by the FoundationDB client library (fdb_c.dll) installed on this system. The binding only supports versions {GetMinApiVersion()} to {GetMaxApiVersion()}. You either need to upgrade the .NET binding or the FoundationDB client library to a newer version.");
if(Logging.On)Logging.Verbose(typeof(Fdb),"Start",String.Format("Will load TLS root certificate and private key from '{0}'",Fdb.Options.TLSCertificatePath));
644
+
if(Logging.On)Logging.Verbose(typeof(Fdb),"Start",$"Will load TLS root certificate and private key from '{Fdb.Options.TLSCertificatePath}'");
0 commit comments