зеркало из https://github.com/dotnet/orleans.git
Address all IDE0034 warnings. Simplify default expressions (#8607)
This commit is contained in:
Родитель
27e71a3054
Коммит
c68d1fd461
|
@ -499,10 +499,10 @@ namespace Orleans.Clustering.DynamoDB
|
|||
}
|
||||
|
||||
parse.StartTime = !string.IsNullOrEmpty(tableEntry.StartTime) ?
|
||||
LogFormatter.ParseDate(tableEntry.StartTime) : default(DateTime);
|
||||
LogFormatter.ParseDate(tableEntry.StartTime) : default;
|
||||
|
||||
parse.IAmAliveTime = !string.IsNullOrEmpty(tableEntry.IAmAliveTime) ?
|
||||
LogFormatter.ParseDate(tableEntry.IAmAliveTime) : default(DateTime);
|
||||
LogFormatter.ParseDate(tableEntry.IAmAliveTime) : default;
|
||||
|
||||
var suspectingSilos = new List<SiloAddress>();
|
||||
var suspectingTimes = new List<DateTime>();
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// <param name="default">The default value if value in position is <see cref="System.DBNull"/>.</param>
|
||||
/// <returns>Either the given value or the default for the requested type.</returns>
|
||||
/// <remarks>This function throws if the given <see paramref="fieldName"/> does not exist.</remarks>
|
||||
public static TValue GetValueOrDefault<TValue>(this IDataRecord record, string fieldName, TValue @default = default(TValue))
|
||||
public static TValue GetValueOrDefault<TValue>(this IDataRecord record, string fieldName, TValue @default = default)
|
||||
{
|
||||
|
||||
try
|
||||
|
@ -165,7 +165,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// <returns>Either the given value or the default for the requested type.</returns>
|
||||
/// <exception cref="DataException"/>
|
||||
/// <remarks>This function throws if the given <see paramref="fieldName"/> does not exist.</remarks>
|
||||
public static async Task<TValue> GetValueOrDefaultAsync<TValue>(this DbDataReader record, string fieldName, TValue @default = default(TValue))
|
||||
public static async Task<TValue> GetValueOrDefaultAsync<TValue>(this DbDataReader record, string fieldName, TValue @default = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -190,7 +190,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// <param name="default">The default value if value in position is <see cref="System.DBNull"/>.</param>
|
||||
/// <returns>Either the given value or the default for the requested type.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException"/>
|
||||
public static TValue GetValueOrDefault<TValue>(this IDataRecord record, int ordinal, TValue @default = default(TValue))
|
||||
public static TValue GetValueOrDefault<TValue>(this IDataRecord record, int ordinal, TValue @default = default)
|
||||
{
|
||||
return record.IsDBNull(ordinal) ? @default : (TValue)record.GetValue(ordinal);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// <param name="default">The default value if value in position is <see cref="System.DBNull"/>.</param>
|
||||
/// <returns>Either the given value or the default for the requested type.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException"/>
|
||||
public static async Task<TValue> GetValueOrDefaultAsync<TValue>(this DbDataReader record, int ordinal, TValue @default = default(TValue))
|
||||
public static async Task<TValue> GetValueOrDefaultAsync<TValue>(this DbDataReader record, int ordinal, TValue @default = default)
|
||||
{
|
||||
|
||||
return (await record.IsDBNullAsync(ordinal).ConfigureAwait(false)) ? @default : (await record.GetFieldValueAsync<TValue>(ordinal).ConfigureAwait(false));
|
||||
|
@ -331,7 +331,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// <returns>Value in the given field indicated by <see paramref="fieldName"/>.</returns>
|
||||
/// <exception cref="DataException"/>
|
||||
/// <remarks>This function throws if the given <see paramref="fieldName"/> does not exist.</remarks>
|
||||
public static async Task<TValue> GetValueAsync<TValue>(this DbDataReader record, string fieldName, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public static async Task<TValue> GetValueAsync<TValue>(this DbDataReader record, string fieldName, CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -356,7 +356,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// <remarks>Does not support collection parameters currently. Does not cache reflection results.</remarks>
|
||||
public static void ReflectionParameterProvider<T>(this IDbCommand command, T parameters, IReadOnlyDictionary<string, string> nameMap = null)
|
||||
{
|
||||
if (!EqualityComparer<T>.Default.Equals(parameters, default(T)))
|
||||
if (!EqualityComparer<T>.Default.Equals(parameters, default))
|
||||
{
|
||||
var properties = parameters.GetType().GetProperties();
|
||||
for (int i = 0; i < properties.Length; ++i)
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
///}).ConfigureAwait(continueOnCapturedContext: false);
|
||||
/// </code>
|
||||
/// </example>
|
||||
Task<IEnumerable<TResult>> ReadAsync<TResult>(string query, Action<IDbCommand> parameterProvider, Func<IDataRecord, int, CancellationToken, Task<TResult>> selector, CommandBehavior commandBehavior = CommandBehavior.Default, CancellationToken cancellationToken = default(CancellationToken));
|
||||
Task<IEnumerable<TResult>> ReadAsync<TResult>(string query, Action<IDbCommand> parameterProvider, Func<IDataRecord, int, CancellationToken, Task<TResult>> selector, CommandBehavior commandBehavior = CommandBehavior.Default, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Executes a given statement. Especially intended to use with <em>INSERT</em>, <em>UPDATE</em>, <em>DELETE</em> or <em>DDL</em> queries.
|
||||
|
@ -97,7 +97,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// }).ConfigureAwait(continueOnCapturedContext: false);
|
||||
/// </code>
|
||||
/// </example>
|
||||
Task<int> ExecuteAsync(string query, Action<IDbCommand> parameterProvider, CommandBehavior commandBehavior = CommandBehavior.Default, CancellationToken cancellationToken = default(CancellationToken));
|
||||
Task<int> ExecuteAsync(string query, Action<IDbCommand> parameterProvider, CommandBehavior commandBehavior = CommandBehavior.Default, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// The well known invariant name of the underlying database.
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
///}).ConfigureAwait(continueOnCapturedContext: false);
|
||||
/// </code>
|
||||
/// </example>
|
||||
public async Task<IEnumerable<TResult>> ReadAsync<TResult>(string query, Action<IDbCommand> parameterProvider, Func<IDataRecord, int, CancellationToken, Task<TResult>> selector, CommandBehavior commandBehavior = CommandBehavior.Default, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public async Task<IEnumerable<TResult>> ReadAsync<TResult>(string query, Action<IDbCommand> parameterProvider, Func<IDataRecord, int, CancellationToken, Task<TResult>> selector, CommandBehavior commandBehavior = CommandBehavior.Default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//If the query is something else that is not acceptable (e.g. an empty string), there will an appropriate database exception.
|
||||
if(query == null)
|
||||
|
@ -186,7 +186,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// }).ConfigureAwait(continueOnCapturedContext: false);
|
||||
/// </code>
|
||||
/// </example>
|
||||
public async Task<int> ExecuteAsync(string query, Action<IDbCommand> parameterProvider, CommandBehavior commandBehavior = CommandBehavior.Default, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public async Task<int> ExecuteAsync(string query, Action<IDbCommand> parameterProvider, CommandBehavior commandBehavior = CommandBehavior.Default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//If the query is something else that is not acceptable (e.g. an empty string), there will an appropriate database exception.
|
||||
if(query == null)
|
||||
|
@ -235,7 +235,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
{
|
||||
using(var reader = await command.ExecuteReaderAsync(commandBehavior, cancellationToken).ConfigureAwait(continueOnCapturedContext: false))
|
||||
{
|
||||
CancellationTokenRegistration cancellationRegistration = default(CancellationTokenRegistration);
|
||||
CancellationTokenRegistration cancellationRegistration = default;
|
||||
try
|
||||
{
|
||||
if(cancellationToken.CanBeCanceled && supportsCommandCancellation)
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// <param name="useSqlParams"><em>TRUE</em> if the query should be in parameterized form. <em>FALSE</em> otherwise.</param>
|
||||
/// <param name="cancellationToken">The cancellation token. Defaults to <see cref="CancellationToken.None"/>.</param>
|
||||
/// <returns>The rows affected.</returns>
|
||||
public static Task<int> ExecuteMultipleInsertIntoAsync<T>(this IRelationalStorage storage, string tableName, IEnumerable<T> parameters, IReadOnlyDictionary<string, string> nameMap = null, IEnumerable<string> onlyOnceColumns = null, bool useSqlParams = true, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public static Task<int> ExecuteMultipleInsertIntoAsync<T>(this IRelationalStorage storage, string tableName, IEnumerable<T> parameters, IReadOnlyDictionary<string, string> nameMap = null, IEnumerable<string> onlyOnceColumns = null, bool useSqlParams = true, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(tableName))
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// IEnumerable<Information> informationData = await db.ReadAsync<Information>(query, new { tname = 200000 });
|
||||
/// </code>
|
||||
/// </example>
|
||||
public static Task<IEnumerable<TResult>> ReadAsync<TResult>(this IRelationalStorage storage, string query, object parameters, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public static Task<IEnumerable<TResult>> ReadAsync<TResult>(this IRelationalStorage storage, string query, object parameters, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return storage.ReadAsync(query, command =>
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// <param name="query">Executes a given statement. Especially intended to use with <em>SELECT</em> statement, but works with other queries too.</param>
|
||||
/// <param name="cancellationToken">The cancellation token. Defaults to <see cref="CancellationToken.None"/>.</param>
|
||||
/// <returns>A list of objects as a result of the <see paramref="query"/>.</returns>
|
||||
public static Task<IEnumerable<TResult>> ReadAsync<TResult>(this IRelationalStorage storage, string query, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public static Task<IEnumerable<TResult>> ReadAsync<TResult>(this IRelationalStorage storage, string query, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return ReadAsync<TResult>(storage, query, null, cancellationToken);
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// await db.ExecuteAsync(query, new { tname = "test_table" });
|
||||
/// </code>
|
||||
/// </example>
|
||||
public static Task<int> ExecuteAsync(this IRelationalStorage storage, string query, object parameters, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public static Task<int> ExecuteAsync(this IRelationalStorage storage, string query, object parameters, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return storage.ExecuteAsync(query, command =>
|
||||
{
|
||||
|
@ -244,7 +244,7 @@ namespace Orleans.Tests.SqlUtils
|
|||
/// <param name="query">Executes a given statement. Especially intended to use with <em>INSERT</em>, <em>UPDATE</em>, <em>DELETE</em> or <em>DDL</em> queries.</param>
|
||||
/// <param name="cancellationToken">The cancellation token. Defaults to <see cref="CancellationToken.None"/>.</param>
|
||||
/// <returns>Affected rows count.</returns>
|
||||
public static Task<int> ExecuteAsync(this IRelationalStorage storage, string query, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public static Task<int> ExecuteAsync(this IRelationalStorage storage, string query, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return ExecuteAsync(storage, query, null, cancellationToken);
|
||||
}
|
||||
|
|
|
@ -249,10 +249,10 @@ namespace Orleans.Runtime.MembershipService
|
|||
parse.FaultZone = int.Parse(tableEntry.FaultZone);
|
||||
|
||||
parse.StartTime = !string.IsNullOrEmpty(tableEntry.StartTime) ?
|
||||
LogFormatter.ParseDate(tableEntry.StartTime) : default(DateTime);
|
||||
LogFormatter.ParseDate(tableEntry.StartTime) : default;
|
||||
|
||||
parse.IAmAliveTime = !string.IsNullOrEmpty(tableEntry.IAmAliveTime) ?
|
||||
LogFormatter.ParseDate(tableEntry.IAmAliveTime) : default(DateTime);
|
||||
LogFormatter.ParseDate(tableEntry.IAmAliveTime) : default;
|
||||
|
||||
var suspectingSilos = new List<SiloAddress>();
|
||||
var suspectingTimes = new List<DateTime>();
|
||||
|
|
|
@ -394,7 +394,7 @@ namespace Orleans.GrainDirectory.AzureStorage
|
|||
const string operation = "ReadSingleTableEntryAsync";
|
||||
var startTime = DateTime.UtcNow;
|
||||
if (Logger.IsEnabled(LogLevel.Trace)) Logger.LogTrace("{Operation} table {TableName} partitionKey {PartitionKey} rowKey {RowKey}", operation, TableName, partitionKey, rowKey);
|
||||
T retrievedResult = default(T);
|
||||
T retrievedResult = default;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace Orleans.Internal
|
|||
int maxNumErrorTries,
|
||||
Func<T, int, bool> retryValueFilter,
|
||||
Func<Exception, int, bool> retryExceptionFilter,
|
||||
TimeSpan maxExecutionTime = default(TimeSpan),
|
||||
TimeSpan maxExecutionTime = default,
|
||||
IBackoffProvider onSuccessBackOff = null,
|
||||
IBackoffProvider onErrorBackOff = null)
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ namespace Orleans.Internal
|
|||
IBackoffProvider onSuccessBackOff = null,
|
||||
IBackoffProvider onErrorBackOff = null)
|
||||
{
|
||||
T result = default(T);
|
||||
T result = default;
|
||||
ExceptionDispatchInfo lastExceptionInfo = null;
|
||||
bool retry;
|
||||
var callCounter = 0;
|
||||
|
@ -211,7 +211,7 @@ namespace Orleans.Internal
|
|||
{
|
||||
retry = false;
|
||||
|
||||
if (maxExecutionTime != Constants.INFINITE_TIMESPAN && maxExecutionTime != default(TimeSpan))
|
||||
if (maxExecutionTime != Constants.INFINITE_TIMESPAN && maxExecutionTime != default)
|
||||
{
|
||||
DateTime now = DateTime.UtcNow;
|
||||
if (now - startExecutionTime > maxExecutionTime)
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace Orleans
|
|||
/// </summary>
|
||||
/// <param name="work">The delegate to invoke when <see cref="BatchWorker.Work"/> is invoked.</param>
|
||||
/// <param name="cancellationToken">The cancellation token used to stop the worker.</param>
|
||||
public BatchWorkerFromDelegate(Func<Task> work, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public BatchWorkerFromDelegate(Func<Task> work, CancellationToken cancellationToken = default)
|
||||
{
|
||||
this.work = work;
|
||||
this.CancellationToken = cancellationToken;
|
||||
|
|
|
@ -192,7 +192,7 @@ namespace Orleans.Serialization
|
|||
return reader.Value switch
|
||||
{
|
||||
long l => new MembershipVersion(l),
|
||||
_ => default(MembershipVersion)
|
||||
_ => default
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,19 +18,19 @@ namespace Orleans.Timers.Internal
|
|||
/// <param name="timeSpan">The time span.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns><see langword="true"/> if the timer ran to completion; otherwise <see langword="false"/>.</returns>
|
||||
Task<bool> Delay(TimeSpan timeSpan, CancellationToken cancellationToken = default(CancellationToken));
|
||||
Task<bool> Delay(TimeSpan timeSpan, CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
internal class TimerManagerImpl : ITimerManager
|
||||
{
|
||||
public Task<bool> Delay(TimeSpan timeSpan, CancellationToken cancellationToken = default(CancellationToken)) => TimerManager.Delay(timeSpan, cancellationToken);
|
||||
public Task<bool> Delay(TimeSpan timeSpan, CancellationToken cancellationToken = default) => TimerManager.Delay(timeSpan, cancellationToken);
|
||||
}
|
||||
|
||||
internal static class TimerManager
|
||||
{
|
||||
public static Task<bool> Delay(TimeSpan timeSpan, CancellationToken cancellationToken = default(CancellationToken)) => DelayUntil(DateTime.UtcNow + timeSpan, cancellationToken);
|
||||
public static Task<bool> Delay(TimeSpan timeSpan, CancellationToken cancellationToken = default) => DelayUntil(DateTime.UtcNow + timeSpan, cancellationToken);
|
||||
|
||||
public static Task<bool> DelayUntil(DateTime dueTime, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public static Task<bool> DelayUntil(DateTime dueTime, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var result = new DelayTimer(dueTime, cancellationToken);
|
||||
TimerManager<DelayTimer>.Register(result);
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace Orleans.Runtime
|
|||
|
||||
DateTime ticket = MakeTicketFromTimeSpan(timeout);
|
||||
|
||||
if (default(DateTime) != item.CollectionTicket)
|
||||
if (default != item.CollectionTicket)
|
||||
{
|
||||
throw new InvalidOperationException("Call CancelCollection before calling ScheduleCollection.");
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ namespace Orleans.Runtime
|
|||
lock (item)
|
||||
{
|
||||
DateTime ticket = item.CollectionTicket;
|
||||
if (default(DateTime) == ticket) return false;
|
||||
if (default == ticket) return false;
|
||||
if (IsExpired(ticket)) return false;
|
||||
|
||||
// first, we attempt to remove the ticket.
|
||||
|
@ -460,7 +460,7 @@ namespace Orleans.Runtime
|
|||
}
|
||||
}
|
||||
|
||||
private async Task CollectActivationsImpl(bool scanStale, TimeSpan ageLimit = default(TimeSpan))
|
||||
private async Task CollectActivationsImpl(bool scanStale, TimeSpan ageLimit = default)
|
||||
{
|
||||
var watch = ValueStopwatch.StartNew();
|
||||
var number = Interlocked.Increment(ref collectionNumber);
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Orleans.Runtime.Messaging
|
|||
protected override Connection CreateConnection(ConnectionContext context)
|
||||
{
|
||||
return new SiloConnection(
|
||||
default(SiloAddress),
|
||||
default,
|
||||
context,
|
||||
this.ConnectionDelegate,
|
||||
this.messageCenter,
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Orleans.Providers.Streams.Common
|
|||
/// <returns><see langword="true"/> if the segment was retrieved; otherwise <see langword="false"/>.</returns>
|
||||
public bool TryGetSegment(int size, out ArraySegment<byte> value)
|
||||
{
|
||||
value = default(ArraySegment<byte>);
|
||||
value = default;
|
||||
if (size > this.SizeInByte - count)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace Orleans.Streams
|
|||
|
||||
// We got an item when we don't think we're the subscriber. This is a normal race condition.
|
||||
// We can drop the item on the floor, or pass it to the rendezvous, or ...
|
||||
return default(StreamHandshakeToken);
|
||||
return default;
|
||||
}
|
||||
|
||||
public async Task<StreamHandshakeToken> DeliverBatch(GuidId subscriptionId, QualifiedStreamId streamId, IBatchContainer batch, StreamHandshakeToken handshakeToken)
|
||||
|
@ -159,7 +159,7 @@ namespace Orleans.Streams
|
|||
|
||||
// We got an item when we don't think we're the subscriber. This is a normal race condition.
|
||||
// We can drop the item on the floor, or pass it to the rendezvous, or ...
|
||||
return default(StreamHandshakeToken);
|
||||
return default;
|
||||
}
|
||||
|
||||
public Task CompleteStream(GuidId subscriptionId)
|
||||
|
|
|
@ -11,13 +11,13 @@ namespace Orleans.Streams
|
|||
|
||||
public static StreamHandshakeToken CreateStartToken(StreamSequenceToken token)
|
||||
{
|
||||
if (token == null) return default(StreamHandshakeToken);
|
||||
if (token == null) return default;
|
||||
return new StartToken {Token = token};
|
||||
}
|
||||
|
||||
public static StreamHandshakeToken CreateDeliveyToken(StreamSequenceToken token)
|
||||
{
|
||||
if (token == null) return default(StreamHandshakeToken);
|
||||
if (token == null) return default;
|
||||
return new DeliveryToken {Token = token};
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Orleans.Transactions.TestKit
|
|||
loadresponse = await stateStorage.Load();
|
||||
loadresponse.Should().NotBeNull();
|
||||
loadresponse.Metadata.Should().NotBeNull();
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default(DateTime));
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default);
|
||||
loadresponse.Metadata.CommitRecords.Should().BeEmpty();
|
||||
loadresponse.ETag.Should().Be(etag1);
|
||||
loadresponse.CommittedSequenceId.Should().Be(0);
|
||||
|
@ -106,7 +106,7 @@ namespace Orleans.Transactions.TestKit
|
|||
// load again
|
||||
loadresponse = await stateStorage.Load();
|
||||
loadresponse.Should().NotBeNull();
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default(DateTime));
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default);
|
||||
loadresponse.Metadata.CommitRecords.Should().BeEmpty();
|
||||
loadresponse.ETag.Should().BeNull();
|
||||
loadresponse.CommittedSequenceId.Should().Be(0);
|
||||
|
@ -154,7 +154,7 @@ namespace Orleans.Transactions.TestKit
|
|||
SequenceId = seqno,
|
||||
TimeStamp = DateTime.UtcNow,
|
||||
TransactionId = Guid.NewGuid().ToString(),
|
||||
TransactionManager = tm ? default(ParticipantId) : MakeParticipantId(),
|
||||
TransactionManager = tm ? default : MakeParticipantId(),
|
||||
State = new TState()
|
||||
};
|
||||
result.State = val;
|
||||
|
@ -246,7 +246,7 @@ namespace Orleans.Transactions.TestKit
|
|||
loadresponse.CommittedSequenceId.Should().Be(1);
|
||||
loadresponse.PendingStates.Count.Should().Be(0);
|
||||
AssertTState(loadresponse.CommittedState, expectedState);
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default(DateTime));
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default);
|
||||
loadresponse.Metadata.CommitRecords.Count.Should().Be(0);
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ namespace Orleans.Transactions.TestKit
|
|||
loadresponse.CommittedSequenceId.Should().Be(0);
|
||||
loadresponse.PendingStates.Count.Should().Be(0);
|
||||
AssertTState(loadresponse.CommittedState,initialstate);
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default(DateTime));
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default);
|
||||
loadresponse.Metadata.CommitRecords.Count.Should().Be(0);
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ namespace Orleans.Transactions.TestKit
|
|||
loadresponse.CommittedSequenceId.Should().Be(1);
|
||||
loadresponse.PendingStates.Count.Should().Be(0);
|
||||
AssertTState(loadresponse.CommittedState,expectedState);
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default(DateTime));
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default);
|
||||
loadresponse.Metadata.CommitRecords.Count.Should().Be(0);
|
||||
}
|
||||
|
||||
|
@ -431,7 +431,7 @@ namespace Orleans.Transactions.TestKit
|
|||
loadresponse.CommittedSequenceId.Should().Be(count);
|
||||
loadresponse.PendingStates.Count.Should().Be(0);
|
||||
AssertTState(loadresponse.CommittedState,expectedStates[count - 1]);
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default(DateTime));
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default);
|
||||
loadresponse.Metadata.CommitRecords.Count.Should().Be(0);
|
||||
}
|
||||
|
||||
|
@ -467,7 +467,7 @@ namespace Orleans.Transactions.TestKit
|
|||
loadresponse.CommittedSequenceId.Should().Be(0);
|
||||
loadresponse.PendingStates.Count.Should().Be(0);
|
||||
AssertTState(loadresponse.CommittedState,initialstate);
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default(DateTime));
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default);
|
||||
loadresponse.Metadata.CommitRecords.Count.Should().Be(0);
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ namespace Orleans.Transactions.TestKit
|
|||
loadresponse.Metadata.Should().NotBeNull();
|
||||
loadresponse.CommittedSequenceId.Should().Be(6);
|
||||
AssertTState(loadresponse.CommittedState, expectedState6);
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default(DateTime));
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default);
|
||||
loadresponse.Metadata.CommitRecords.Count.Should().Be(0);
|
||||
loadresponse.PendingStates.Count.Should().Be(2);
|
||||
loadresponse.PendingStates[0].SequenceId.Should().Be(7);
|
||||
|
@ -614,7 +614,7 @@ namespace Orleans.Transactions.TestKit
|
|||
loadresponse.Metadata.Should().NotBeNull();
|
||||
loadresponse.CommittedSequenceId.Should().Be(3);
|
||||
AssertTState(loadresponse.CommittedState, expectedState3b);
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default(DateTime));
|
||||
loadresponse.Metadata.TimeStamp.Should().Be(default);
|
||||
loadresponse.Metadata.CommitRecords.Count.Should().Be(0);
|
||||
loadresponse.PendingStates.Count.Should().Be(1);
|
||||
loadresponse.PendingStates[0].SequenceId.Should().Be(4);
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace Orleans.Transactions
|
|||
info.RecordRead(this.participantId, record.Timestamp);
|
||||
|
||||
// perform the read
|
||||
TResult result = default(TResult);
|
||||
TResult result = default;
|
||||
try
|
||||
{
|
||||
detectReentrancy = true;
|
||||
|
|
|
@ -177,7 +177,7 @@ namespace Tester.CodeGenTests
|
|||
Assert.Equal(new[] { typeof(IGrain), typeof(string) }, await grain.GetTypesInferred(default(IGrain), default(string), 0));
|
||||
var now = DateTime.Now;
|
||||
Assert.Equal(now, await grain.RoundTrip(now));
|
||||
Assert.Equal(default(DateTime), await grain.Default<DateTime>());
|
||||
Assert.Equal(default, await grain.Default<DateTime>());
|
||||
|
||||
Assert.Equal(grain, await grain.Constraints(grain));
|
||||
}
|
||||
|
|
|
@ -263,9 +263,9 @@ namespace AWSUtils.Tests.StorageTests
|
|||
TimeSpan readTime = sw.Elapsed;
|
||||
this.output.WriteLine("{0} - Write time = {1} Read time = {2}", store.GetType().FullName, writeTime, readTime);
|
||||
Assert.NotNull(storedGrainState.State);
|
||||
Assert.Equal(default(string), storedGrainState.State.A);
|
||||
Assert.Equal(default(int), storedGrainState.State.B);
|
||||
Assert.Equal(default(long), storedGrainState.State.C);
|
||||
Assert.Equal(default, storedGrainState.State.A);
|
||||
Assert.Equal(default, storedGrainState.State.B);
|
||||
Assert.Equal(default, storedGrainState.State.C);
|
||||
|
||||
return storedGrainState;
|
||||
}
|
||||
|
|
|
@ -220,9 +220,9 @@ public class PersistenceProviderTests_Cosmos
|
|||
TimeSpan readTime = sw.Elapsed;
|
||||
output.WriteLine("{0} - Write time = {1} Read time = {2}", store.GetType().FullName, writeTime, readTime);
|
||||
Assert.NotNull(storedGrainState.State);
|
||||
Assert.Equal(default(string), storedGrainState.State.A);
|
||||
Assert.Equal(default(int), storedGrainState.State.B);
|
||||
Assert.Equal(default(long), storedGrainState.State.C);
|
||||
Assert.Equal(default, storedGrainState.State.A);
|
||||
Assert.Equal(default, storedGrainState.State.B);
|
||||
Assert.Equal(default, storedGrainState.State.C);
|
||||
|
||||
return storedGrainState;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace Tester.Redis.Persistence
|
|||
var result = await grain.DoRead();
|
||||
|
||||
//Assert.NotNull(result);
|
||||
Assert.Equal(default(GrainState), result);
|
||||
Assert.Equal(default, result);
|
||||
//Assert.Equal(default(string), result.StringValue);
|
||||
//Assert.Equal(default(int), result.IntValue);
|
||||
//Assert.Equal(default(DateTime), result.DateTimeValue);
|
||||
|
|
|
@ -376,9 +376,9 @@ namespace Tester.AzureUtils.Persistence
|
|||
TimeSpan readTime = sw.Elapsed;
|
||||
this.output.WriteLine("{0} - Write time = {1} Read time = {2}", store.GetType().FullName, writeTime, readTime);
|
||||
Assert.NotNull(storedGrainState.State);
|
||||
Assert.Equal(default(string), storedGrainState.State.A);
|
||||
Assert.Equal(default(int), storedGrainState.State.B);
|
||||
Assert.Equal(default(long), storedGrainState.State.C);
|
||||
Assert.Equal(default, storedGrainState.State.A);
|
||||
Assert.Equal(default, storedGrainState.State.B);
|
||||
Assert.Equal(default, storedGrainState.State.C);
|
||||
|
||||
return storedGrainState;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace BenchmarkGrains.Transaction
|
|||
|
||||
public async Task<Report> TryGetReport()
|
||||
{
|
||||
if (!this.runTask.IsCompleted) return default(Report);
|
||||
if (!this.runTask.IsCompleted) return default;
|
||||
return await this.runTask;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace UnitTests.Grains
|
|||
|
||||
public override Task OnActivateAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
ExtensionProperty = default(T);
|
||||
ExtensionProperty = default;
|
||||
extender = null;
|
||||
return base.OnActivateAsync(cancellationToken);
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace UnitTests.Grains
|
|||
|
||||
_itemsProduced = 0;
|
||||
_expectedItemsProduced = 0;
|
||||
_streamId = default(Guid);
|
||||
_streamId = default;
|
||||
_providerName = null;
|
||||
_cleanedUpFlag = new InterlockedFlag();
|
||||
_observerDisposedYet = false;
|
||||
|
|
|
@ -115,7 +115,7 @@ namespace NonSilo.Tests
|
|||
myFunc,
|
||||
maxRetries,
|
||||
errorFilter,
|
||||
default(TimeSpan),
|
||||
default,
|
||||
new FixedBackoff(TimeSpan.FromSeconds(1)));
|
||||
|
||||
int value = promise.Result;
|
||||
|
@ -154,7 +154,7 @@ namespace NonSilo.Tests
|
|||
myFunc,
|
||||
maxRetries,
|
||||
errorFilter,
|
||||
default(TimeSpan),
|
||||
default,
|
||||
new FixedBackoff(TimeSpan.FromSeconds(1)));
|
||||
try
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace NonSilo.Tests.Directory
|
|||
_clusterMembershipService.UpdateSiloStatus(_localSilo, SiloStatus.Active, "local-silo");
|
||||
|
||||
_grainFactory = Substitute.For<IInternalGrainFactory>();
|
||||
_grainFactory.GetSystemTarget<IRemoteClientDirectory>(default(GrainType), default(SiloAddress))
|
||||
_grainFactory.GetSystemTarget<IRemoteClientDirectory>(default, default)
|
||||
.ReturnsForAnyArgs(info => _remoteDirectories.GetOrAdd(info.ArgAt<SiloAddress>(1), k => Substitute.For<IRemoteClientDirectory>()));
|
||||
|
||||
_directory = new ClientDirectory(
|
||||
|
|
|
@ -405,7 +405,7 @@ public class GeneratedSerializerTests : IDisposable
|
|||
original.StringProperty = "bananas";
|
||||
result = RoundTripThroughCodec(original);
|
||||
|
||||
Assert.Equal(default(Guid), result.GuidProperty);
|
||||
Assert.Equal(default, result.GuidProperty);
|
||||
Assert.Equal(original.GuidProperty, result.GuidProperty);
|
||||
Assert.Equal("bananas", result.StringProperty);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class NumericsWideningAndNarrowingTests
|
|||
var values = new List<N>
|
||||
{
|
||||
N.MinValue,
|
||||
default(N),
|
||||
default,
|
||||
N.MaxValue / two,
|
||||
N.MaxValue,
|
||||
};
|
||||
|
@ -127,7 +127,7 @@ public class NumericsWideningAndNarrowingTests
|
|||
var values = (new N[]
|
||||
{
|
||||
N.MinValue,
|
||||
default(N),
|
||||
default,
|
||||
N.MaxValue / two,
|
||||
N.MaxValue,
|
||||
}).Select(W.CreateTruncating).ToList();
|
||||
|
@ -165,7 +165,7 @@ public class NumericsWideningAndNarrowingTests
|
|||
{
|
||||
N.MinValue + buffer,
|
||||
N.MinValue / two,
|
||||
default(N),
|
||||
default,
|
||||
N.MaxValue / two,
|
||||
N.MaxValue - buffer,
|
||||
};
|
||||
|
@ -186,7 +186,7 @@ public class NumericsWideningAndNarrowingTests
|
|||
{
|
||||
N.MinValue + buffer,
|
||||
N.MinValue / two,
|
||||
default(N),
|
||||
default,
|
||||
N.MaxValue / two,
|
||||
N.MaxValue - buffer,
|
||||
}.Select(W.CreateTruncating).ToList();
|
||||
|
@ -354,7 +354,7 @@ public class NumericsWideningAndNarrowingTests
|
|||
var values = new List<N>
|
||||
{
|
||||
n.MinValue,
|
||||
default(N),
|
||||
default,
|
||||
n.Divide(n.MaxValue, two),
|
||||
n.MaxValue,
|
||||
};
|
||||
|
@ -371,7 +371,7 @@ public class NumericsWideningAndNarrowingTests
|
|||
var values = (new N[]
|
||||
{
|
||||
n.MinValue,
|
||||
default(N),
|
||||
default,
|
||||
n.Divide(n.MaxValue, two),
|
||||
n.MaxValue,
|
||||
}).Select(w.CreateTruncating).ToList();
|
||||
|
@ -405,7 +405,7 @@ public class NumericsWideningAndNarrowingTests
|
|||
{
|
||||
n.Add(n.MinValue, buffer),
|
||||
n.Divide(n.MinValue, two),
|
||||
default(N),
|
||||
default,
|
||||
n.Divide(n.MaxValue, two),
|
||||
n.Subtract(n.MaxValue, buffer),
|
||||
};
|
||||
|
@ -424,7 +424,7 @@ public class NumericsWideningAndNarrowingTests
|
|||
{
|
||||
n.Add(n.MinValue, buffer),
|
||||
n.Divide(n.MinValue, two),
|
||||
default(N),
|
||||
default,
|
||||
n.Divide(n.MaxValue, two),
|
||||
n.Subtract(n.MaxValue, buffer),
|
||||
}.Select(w.CreateTruncating).ToList();
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace UnitTests
|
|||
/// <param name="operation">The operation to retry.</param>
|
||||
/// <param name="cancellation">The cancellation token.</param>
|
||||
/// <returns>The result of the retry.</returns>
|
||||
internal static async Task<TResult> RetryOnExceptionAsync<TResult>(int maxAttempts, Func<int, TimeSpan> retryFunction, Func<Task<TResult>> operation, CancellationToken cancellation = default(CancellationToken))
|
||||
internal static async Task<TResult> RetryOnExceptionAsync<TResult>(int maxAttempts, Func<int, TimeSpan> retryFunction, Func<Task<TResult>> operation, CancellationToken cancellation = default)
|
||||
{
|
||||
const int MinAttempts = 1;
|
||||
if(maxAttempts <= MinAttempts)
|
||||
|
|
Загрузка…
Ссылка в новой задаче