diff --git a/.editorconfig b/.editorconfig
index 9f69e2158..12bc97524 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,66 +1,207 @@
-# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
-###############################
-# Core EditorConfig Options #
-###############################
-root = true
+# Remove the line below if you want to inherit .editorconfig settings from higher directories
+root = true
-# All files
-[*]
-indent_style = space
+# C# files
+[*.cs]
-# Code files
-[*.cs]
+#### Core EditorConfig Options ####
+
+# Indentation and spacing
indent_size = 4
+indent_style = space
tab_width = 4
-trim_trailing_whitespace = true
-###############################
-# .NET Coding Conventions #
-###############################
-[*.cs]
-# Organize usings
+# New line preferences
+end_of_line = crlf
+insert_final_newline = false
+
+#### .NET Coding Conventions ####
+
+# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = true
+file_header_template = unset
-# this. preferences
-dotnet_style_qualification_for_field = true:error
-dotnet_style_qualification_for_property = true:error
-dotnet_style_qualification_for_method = true:error
+# this. and Me. preferences
dotnet_style_qualification_for_event = true:error
+dotnet_style_qualification_for_field = true:error
+dotnet_style_qualification_for_method = true:error
+dotnet_style_qualification_for_property = true:error
-# New line preferences
-csharp_new_line_before_open_brace = all
+# Language keywords vs BCL types preferences
+dotnet_style_predefined_type_for_locals_parameters_members = true:silent
+dotnet_style_predefined_type_for_member_access = true:silent
-# Indentation preferences
-csharp_indent_case_contents = true
-csharp_indent_switch_labels = true
-csharp_indent_labels = flush_left
+# Parentheses preferences
+dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:error
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:error
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary:error
+dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:error
-# Space preferences
-csharp_space_after_keywords_in_control_flow_statements = true
+# Modifier preferences
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
-# Parentheses preferences
-dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:error
-dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:error
-dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:error
-dotnet_style_parentheses_in_other_operators = never_if_unnecessary:error
+# Expression-level preferences
+dotnet_style_coalesce_expression = true:error
+dotnet_style_collection_initializer = true:error
+dotnet_style_explicit_tuple_names = true:error
+dotnet_style_null_propagation = true:error
+dotnet_style_object_initializer = true:error
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+dotnet_style_prefer_auto_properties = true:error
+dotnet_style_prefer_compound_assignment = true:error
+dotnet_style_prefer_conditional_expression_over_assignment = true:error
+dotnet_style_prefer_conditional_expression_over_return = false:silent
+dotnet_style_prefer_inferred_anonymous_type_member_names = true:error
+dotnet_style_prefer_inferred_tuple_names = true:error
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:error
+dotnet_style_prefer_simplified_boolean_expressions = true:error
+dotnet_style_prefer_simplified_interpolation = true:error
-# Expression-level preferences
-dotnet_style_prefer_auto_properties = true:error
-dotnet_style_prefer_is_null_check_over_reference_equality_method = true:error
+# Field preferences
+dotnet_style_readonly_field = true:error
-# CSharp code style settings:
+# Parameter preferences
+dotnet_code_quality_unused_parameters = all:error
+
+#### C# Coding Conventions ####
+
+# var preferences
+csharp_style_var_elsewhere = false:error
csharp_style_var_for_built_in_types = false:error
csharp_style_var_when_type_is_apparent = false:error
-csharp_style_var_elsewhere = false:error
-# Patern matching
-csharp_style_pattern_matching_over_is_with_cast_check = true:error
+# Expression-bodied members
+csharp_style_expression_bodied_accessors = true:error
+csharp_style_expression_bodied_constructors = false:error
+csharp_style_expression_bodied_indexers = true:error
+csharp_style_expression_bodied_lambdas = true:error
+csharp_style_expression_bodied_local_functions = false:error
+csharp_style_expression_bodied_methods = false:error
+csharp_style_expression_bodied_operators = false:error
+csharp_style_expression_bodied_properties = true:error
+
+# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:error
+csharp_style_pattern_matching_over_is_with_cast_check = true:error
+csharp_style_prefer_switch_expression = true:error
+
+# Null-checking preferences
+csharp_style_conditional_delegate_call = true:error
+
+# Modifier preferences
+csharp_prefer_static_local_function = true:error
+csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
+
+# Code-block preferences
+csharp_prefer_braces = true:silent
+csharp_prefer_simple_using_statement = true:silent
+
+# Expression-level preferences
+csharp_prefer_simple_default_expression = true:error
+csharp_style_deconstructed_variable_declaration = true:error
+csharp_style_inlined_variable_declaration = true:error
+csharp_style_pattern_local_over_anonymous_function = true:error
+csharp_style_prefer_index_operator = true:error
+csharp_style_prefer_range_operator = true:error
+csharp_style_throw_expression = true:error
+csharp_style_unused_value_assignment_preference = discard_variable:error
+csharp_style_unused_value_expression_statement_preference = discard_variable:silent
+
+# 'using' directive preferences
+csharp_using_directive_placement = inside_namespace :error
+
+#### C# Formatting Rules ####
+
+# New line preferences
+csharp_new_line_before_catch = true
+csharp_new_line_before_else = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_open_brace = all
+csharp_new_line_between_query_expression_clauses = true
+
+# Indentation preferences
+csharp_indent_block_contents = true
+csharp_indent_braces = false
+csharp_indent_case_contents = true
+csharp_indent_case_contents_when_block = true
+csharp_indent_labels = one_less_than_current
+csharp_indent_switch_labels = true
+
+# Space preferences
+csharp_space_after_cast = false
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_after_comma = true
+csharp_space_after_dot = false
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_after_semicolon_in_for_statement = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_around_declaration_statements = false
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_before_comma = false
+csharp_space_before_dot = false
+csharp_space_before_open_square_brackets = false
+csharp_space_before_semicolon_in_for_statement = false
+csharp_space_between_empty_square_brackets = false
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_declaration_name_and_open_parenthesis = false
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_parentheses = false
+csharp_space_between_square_brackets = false
+
+# Wrapping preferences
+csharp_preserve_single_line_blocks = true
+csharp_preserve_single_line_statements = true
+
+#### Naming styles ####
+
+# Naming rules
+
+dotnet_naming_rule.interface_should_be_begins_with_i.severity = error
+dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
+dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
+
+dotnet_naming_rule.types_should_be_pascal_case.severity = error
+dotnet_naming_rule.types_should_be_pascal_case.symbols = types
+dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
+
+dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error
+dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
+dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
+
+# Symbol specifications
+
+dotnet_naming_symbols.interface.applicable_kinds = interface
+dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.interface.required_modifiers =
+
+dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
+dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.types.required_modifiers =
+
+dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
+dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.non_field_members.required_modifiers =
+
+# Naming styles
+
+dotnet_naming_style.pascal_case.required_prefix =
+dotnet_naming_style.pascal_case.required_suffix =
+dotnet_naming_style.pascal_case.word_separator =
+dotnet_naming_style.pascal_case.capitalization = pascal_case
+
+dotnet_naming_style.begins_with_i.required_prefix = I
+dotnet_naming_style.begins_with_i.required_suffix =
+dotnet_naming_style.begins_with_i.word_separator =
+dotnet_naming_style.begins_with_i.capitalization = pascal_case
## Naming Conventions
# Async methods should have [Async] suffix
-[*.cs]
dotnet_naming_rule.async_method_must_end_with_async.symbols = async_methods
dotnet_naming_symbols.async_methods.applicable_kinds = method
dotnet_naming_symbols.async_methods.applicable_accessibilities = *
diff --git a/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/AzureKeyVaultKeyWrapMetadata.cs b/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/AzureKeyVaultKeyWrapMetadata.cs
index b97c45af3..3f6df5d14 100644
--- a/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/AzureKeyVaultKeyWrapMetadata.cs
+++ b/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/AzureKeyVaultKeyWrapMetadata.cs
@@ -11,7 +11,7 @@ namespace Microsoft.Azure.Cosmos.Encryption
///
public sealed class AzureKeyVaultKeyWrapMetadata : EncryptionKeyWrapMetadata
{
- internal static string TypeConstant = "akv";
+ internal const string TypeConstant = "akv";
///
/// Creates a new instance of metadata that the Azure Key Vault can use to wrap and unwrap keys.
diff --git a/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/AzureKeyVaultKeyWrapProvider.cs b/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/AzureKeyVaultKeyWrapProvider.cs
index be02cec48..efaf407ec 100644
--- a/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/AzureKeyVaultKeyWrapProvider.cs
+++ b/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/AzureKeyVaultKeyWrapProvider.cs
@@ -80,7 +80,7 @@ namespace Microsoft.Azure.Cosmos.Encryption
if (!KeyVaultKeyUriProperties.TryParse(new Uri(metadata.Value), out KeyVaultKeyUriProperties keyVaultUriProperties))
{
- throw new ArgumentException("KeyVault Key Uri {0} is invalid.",metadata.Value);
+ throw new ArgumentException("KeyVault Key Uri {0} is invalid.", metadata.Value);
}
if (!await this.keyVaultAccessClient.ValidatePurgeProtectionAndSoftDeleteSettingsAsync(keyVaultUriProperties, cancellationToken))
diff --git a/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/KeyVaultAccessException.cs b/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/KeyVaultAccessException.cs
index a5e89d4e2..5e0db9c9a 100644
--- a/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/KeyVaultAccessException.cs
+++ b/Microsoft.Azure.Cosmos.Encryption/src/KeyVault/KeyVaultAccessException.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Azure.Cosmos.Encryption
internal class KeyVaultAccessException : RequestFailedException
{
- public KeyVaultAccessException(int statusCode, string keyVaultErrorCode, string? errorMessage, Exception? innerException)
+ public KeyVaultAccessException(int statusCode, string keyVaultErrorCode, string errorMessage, Exception innerException)
: base(statusCode, keyVaultErrorCode, errorMessage, innerException)
{
}
diff --git a/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncBatcher.cs b/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncBatcher.cs
index 24edc147d..a7a8ea247 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncBatcher.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncBatcher.cs
@@ -56,27 +56,12 @@ namespace Microsoft.Azure.Cosmos
throw new ArgumentOutOfRangeException(nameof(maxBatchByteSize));
}
- if (executor == null)
- {
- throw new ArgumentNullException(nameof(executor));
- }
-
- if (retrier == null)
- {
- throw new ArgumentNullException(nameof(retrier));
- }
-
- if (serializerCore == null)
- {
- throw new ArgumentNullException(nameof(serializerCore));
- }
-
this.batchOperations = new List(maxBatchOperationCount);
- this.executor = executor;
- this.retrier = retrier;
+ this.executor = executor ?? throw new ArgumentNullException(nameof(executor));
+ this.retrier = retrier ?? throw new ArgumentNullException(nameof(retrier));
this.maxBatchByteSize = maxBatchByteSize;
this.maxBatchOperationCount = maxBatchOperationCount;
- this.serializerCore = serializerCore;
+ this.serializerCore = serializerCore ?? throw new ArgumentNullException(nameof(serializerCore));
}
public virtual bool TryAdd(ItemBatchOperation operation)
@@ -122,7 +107,7 @@ namespace Microsoft.Azure.Cosmos
public virtual async Task DispatchAsync(
BatchPartitionMetric partitionMetric,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
this.interlockIncrementCheck.EnterLockCheck();
@@ -183,7 +168,7 @@ namespace Microsoft.Azure.Cosmos
{
response.DiagnosticsContext = batchResponse.DiagnosticsContext;
}
-
+
if (!response.IsSuccessStatusCode)
{
Documents.ShouldRetryResult shouldRetry = await itemBatchOperation.Context.ShouldRetryAsync(response, cancellationToken);
diff --git a/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutor.cs b/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutor.cs
index 57bcf4b4f..20f70f92a 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutor.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutor.cs
@@ -27,7 +27,7 @@ namespace Microsoft.Azure.Cosmos
{
private const int DefaultDispatchTimerInSeconds = 1;
private const int TimerWheelBucketCount = 20;
- private readonly static TimeSpan TimerWheelResolution = TimeSpan.FromMilliseconds(50);
+ private static readonly TimeSpan TimerWheelResolution = TimeSpan.FromMilliseconds(50);
private readonly ContainerInternal cosmosContainer;
private readonly CosmosClientContext cosmosClientContext;
@@ -78,7 +78,7 @@ namespace Microsoft.Azure.Cosmos
public virtual async Task AddAsync(
ItemBatchOperation operation,
ItemRequestOptions itemRequestOptions = null,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
if (operation == null)
{
@@ -113,7 +113,7 @@ namespace Microsoft.Azure.Cosmos
internal virtual async Task ValidateOperationAsync(
ItemBatchOperation operation,
ItemRequestOptions itemRequestOptions = null,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
if (itemRequestOptions != null)
{
diff --git a/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutorCache.cs b/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutorCache.cs
index a16683b40..6312a542e 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutorCache.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutorCache.cs
@@ -16,7 +16,7 @@ namespace Microsoft.Azure.Cosmos
{
// Keeping same performance tuned value of Bulk V2.
internal const int DefaultMaxBulkRequestBodySizeInBytes = 220201;
- private ConcurrentDictionary executorsPerContainer = new ConcurrentDictionary();
+ private readonly ConcurrentDictionary executorsPerContainer = new ConcurrentDictionary();
public BatchAsyncContainerExecutor GetExecutorForContainer(
ContainerInternal container,
diff --git a/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncStreamer.cs b/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncStreamer.cs
index 991257d9d..97d102087 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncStreamer.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncStreamer.cs
@@ -34,6 +34,9 @@ namespace Microsoft.Azure.Cosmos
private readonly int congestionDecreaseFactor = 5;
private readonly int maxDegreeOfConcurrency;
private readonly TimerWheel timerWheel;
+ private readonly SemaphoreSlim limiter;
+ private readonly BatchPartitionMetric oldPartitionMetric;
+ private readonly BatchPartitionMetric partitionMetric;
private volatile BatchAsyncBatcher currentBatcher;
private TimerWheelTimer currentTimer;
@@ -41,12 +44,9 @@ namespace Microsoft.Azure.Cosmos
private TimerWheelTimer congestionControlTimer;
private Task congestionControlTask;
- private SemaphoreSlim limiter;
private int congestionDegreeOfConcurrency = 1;
private long congestionWaitTimeInMilliseconds = 1000;
- private BatchPartitionMetric oldPartitionMetric;
- private BatchPartitionMetric partitionMetric;
public BatchAsyncStreamer(
int maxBatchOperationCount,
diff --git a/Microsoft.Azure.Cosmos/src/Batch/BatchCore.cs b/Microsoft.Azure.Cosmos/src/Batch/BatchCore.cs
index 70dffd87f..6817635fa 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/BatchCore.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/BatchCore.cs
@@ -201,7 +201,7 @@ namespace Microsoft.Azure.Cosmos
}
public override Task ExecuteAsync(
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
return this.ExecuteAsync(
requestOptions: null,
@@ -216,7 +216,7 @@ namespace Microsoft.Azure.Cosmos
/// An awaitable which contains the completion status and results of each operation.
public override Task ExecuteAsync(
TransactionalBatchRequestOptions requestOptions,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
return this.container.ClientContext.OperationHelperAsync(
nameof(ExecuteAsync),
diff --git a/Microsoft.Azure.Cosmos/src/Batch/ItemBatchOperation.cs b/Microsoft.Azure.Cosmos/src/Batch/ItemBatchOperation.cs
index da3869ce6..a037ed5bb 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/ItemBatchOperation.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/ItemBatchOperation.cs
@@ -6,7 +6,6 @@ namespace Microsoft.Azure.Cosmos
{
using System;
using System.Diagnostics;
- using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -92,10 +91,7 @@ namespace Microsoft.Azure.Cosmos
return this.body;
}
- set
- {
- this.body = value;
- }
+ set => this.body = value;
}
///
diff --git a/Microsoft.Azure.Cosmos/src/Batch/ItemBatchOperationContext.cs b/Microsoft.Azure.Cosmos/src/Batch/ItemBatchOperationContext.cs
index 4cc77fd00..f384b0449 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/ItemBatchOperationContext.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/ItemBatchOperationContext.cs
@@ -23,7 +23,7 @@ namespace Microsoft.Azure.Cosmos
private readonly IDocumentClientRetryPolicy retryPolicy;
- private TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
+ private readonly TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
public ItemBatchOperationContext(
string partitionKeyRangeId,
diff --git a/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeBatchExecutionResult.cs b/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeBatchExecutionResult.cs
index a8778cd0b..8107610d0 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeBatchExecutionResult.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeBatchExecutionResult.cs
@@ -25,10 +25,13 @@ namespace Microsoft.Azure.Cosmos
this.Operations = operations;
}
- internal bool IsSplit() => this.ServerResponse != null &&
- this.ServerResponse.StatusCode == HttpStatusCode.Gone
- && (this.ServerResponse.SubStatusCode == Documents.SubStatusCodes.CompletingSplit
- || this.ServerResponse.SubStatusCode == Documents.SubStatusCodes.CompletingPartitionMigration
- || this.ServerResponse.SubStatusCode == Documents.SubStatusCodes.PartitionKeyRangeGone);
+ internal bool IsSplit()
+ {
+ return this.ServerResponse != null &&
+ this.ServerResponse.StatusCode == HttpStatusCode.Gone
+ && (this.ServerResponse.SubStatusCode == Documents.SubStatusCodes.CompletingSplit
+ || this.ServerResponse.SubStatusCode == Documents.SubStatusCodes.CompletingPartitionMigration
+ || this.ServerResponse.SubStatusCode == Documents.SubStatusCodes.PartitionKeyRangeGone);
+ }
}
}
\ No newline at end of file
diff --git a/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeBatchResponse.cs b/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeBatchResponse.cs
index 352323685..317328fb9 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeBatchResponse.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeBatchResponse.cs
@@ -97,7 +97,7 @@ namespace Microsoft.Azure.Cosmos
TransactionalBatchOperationResult result = this.resultsByOperationIndex[index];
- T resource = default(T);
+ T resource = default;
if (result.ResourceStream != null)
{
resource = this.SerializerCore.FromStream(result.ResourceStream);
diff --git a/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeServerBatchRequest.cs b/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeServerBatchRequest.cs
index 546092288..e4c83b278 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeServerBatchRequest.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/PartitionKeyRangeServerBatchRequest.cs
@@ -5,10 +5,8 @@
namespace Microsoft.Azure.Cosmos
{
using System;
- using System.Net;
using System.Threading;
using System.Threading.Tasks;
- using Microsoft.Azure.Documents;
internal sealed class PartitionKeyRangeServerBatchRequest : ServerBatchRequest
{
diff --git a/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatch.cs b/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatch.cs
index 76e008507..1c4acf5da 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatch.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatch.cs
@@ -4,7 +4,6 @@
namespace Microsoft.Azure.Cosmos
{
- using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Threading;
@@ -217,7 +216,7 @@ namespace Microsoft.Azure.Cosmos
/// The transactional batch instance with the operation added.
public abstract TransactionalBatch PatchItem(
string id,
- IReadOnlyList patchOperations,
+ System.Collections.Generic.IReadOnlyList patchOperations,
TransactionalBatchItemRequestOptions requestOptions = null);
#endif
@@ -249,7 +248,7 @@ namespace Microsoft.Azure.Cosmos
/// Use on the response returned to ensure that the transactional batch succeeded.
///
public abstract Task ExecuteAsync(
- CancellationToken cancellationToken = default(CancellationToken));
+ CancellationToken cancellationToken = default);
///
/// Executes the transactional batch at the Azure Cosmos service as an asynchronous operation.
@@ -281,6 +280,6 @@ namespace Microsoft.Azure.Cosmos
///
public abstract Task ExecuteAsync(
TransactionalBatchRequestOptions requestOptions,
- CancellationToken cancellationToken = default(CancellationToken));
+ CancellationToken cancellationToken = default);
}
}
diff --git a/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchItemRequestOptions.cs b/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchItemRequestOptions.cs
index 24aaeeebd..0fcec01d4 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchItemRequestOptions.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchItemRequestOptions.cs
@@ -47,15 +47,17 @@ namespace Microsoft.Azure.Cosmos
return null;
}
- RequestOptions requestOptions = itemRequestOptions as RequestOptions;
- TransactionalBatchItemRequestOptions batchItemRequestOptions = new TransactionalBatchItemRequestOptions();
- batchItemRequestOptions.IndexingDirective = itemRequestOptions.IndexingDirective;
- batchItemRequestOptions.IfMatchEtag = itemRequestOptions.IfMatchEtag;
- batchItemRequestOptions.IfNoneMatchEtag = itemRequestOptions.IfNoneMatchEtag;
- batchItemRequestOptions.Properties = itemRequestOptions.Properties;
- batchItemRequestOptions.EnableContentResponseOnWrite = itemRequestOptions.EnableContentResponseOnWrite;
- batchItemRequestOptions.EnableContentResponseOnRead = itemRequestOptions.EnableContentResponseOnRead;
- batchItemRequestOptions.IsEffectivePartitionKeyRouting = itemRequestOptions.IsEffectivePartitionKeyRouting;
+ RequestOptions requestOptions = itemRequestOptions;
+ TransactionalBatchItemRequestOptions batchItemRequestOptions = new TransactionalBatchItemRequestOptions
+ {
+ IndexingDirective = itemRequestOptions.IndexingDirective,
+ IfMatchEtag = itemRequestOptions.IfMatchEtag,
+ IfNoneMatchEtag = itemRequestOptions.IfNoneMatchEtag,
+ Properties = itemRequestOptions.Properties,
+ EnableContentResponseOnWrite = itemRequestOptions.EnableContentResponseOnWrite,
+ EnableContentResponseOnRead = itemRequestOptions.EnableContentResponseOnRead,
+ IsEffectivePartitionKeyRouting = itemRequestOptions.IsEffectivePartitionKeyRouting
+ };
return batchItemRequestOptions;
}
}
diff --git a/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchOperationResult.cs b/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchOperationResult.cs
index a76b9c844..9a936ee7d 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchOperationResult.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchOperationResult.cs
@@ -208,7 +208,7 @@ namespace Microsoft.Azure.Cosmos
RetryAfter = this.RetryAfter,
RequestCharge = this.RequestCharge,
};
-
+
ResponseMessage responseMessage = new ResponseMessage(
statusCode: this.StatusCode,
requestMessage: null,
diff --git a/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchResponse.cs b/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchResponse.cs
index 5acc8515a..77f0467bd 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchResponse.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchResponse.cs
@@ -148,13 +148,7 @@ namespace Microsoft.Azure.Cosmos
///
/// 0-based index of the operation in the batch whose result needs to be returned.
/// Result of operation at the provided index in the batch.
- public virtual TransactionalBatchOperationResult this[int index]
- {
- get
- {
- return this.results[index];
- }
- }
+ public virtual TransactionalBatchOperationResult this[int index] => this.results[index];
///
/// Gets the result of the operation at the provided index in the batch - the returned result has a Resource of provided type.
@@ -166,7 +160,7 @@ namespace Microsoft.Azure.Cosmos
{
TransactionalBatchOperationResult result = this.results[index];
- T resource = default(T);
+ T resource = default;
if (result.ResourceStream != null)
{
resource = this.SerializerCore.FromStream(result.ResourceStream);
@@ -378,9 +372,10 @@ namespace Microsoft.Azure.Cosmos
responseMessage.Headers,
responseMessage.DiagnosticsContext,
serverRequest.Operations,
- serializer);
-
- response.results = results;
+ serializer)
+ {
+ results = results
+ };
return response;
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs
index 3c4d47508..fbf8c49fc 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs
@@ -120,7 +120,10 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
}
}
- public override CosmosElement GetCosmosElementContinuationToken() => CosmosElement.Parse(this.FeedRangeContinuation.ToString());
+ public override CosmosElement GetCosmosElementContinuationToken()
+ {
+ return CosmosElement.Parse(this.FeedRangeContinuation.ToString());
+ }
private async Task ReadNextInternalAsync(
CosmosDiagnosticsContext diagnosticsScope,
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedPartitionKeyResultSetIteratorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedPartitionKeyResultSetIteratorCore.cs
index 01a40e292..ec9b54f67 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedPartitionKeyResultSetIteratorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedPartitionKeyResultSetIteratorCore.cs
@@ -5,7 +5,6 @@
namespace Microsoft.Azure.Cosmos.ChangeFeed
{
using System;
- using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos.CosmosElements;
@@ -35,14 +34,17 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
public override bool HasMoreResults => this.hasMoreResultsInternal;
- public override CosmosElement GetCosmosElementContinuationToken() => throw new NotImplementedException();
+ public override CosmosElement GetCosmosElementContinuationToken()
+ {
+ throw new NotImplementedException();
+ }
///
/// Get the next set of results from the cosmos service
///
/// (Optional) representing request cancellation.
/// A change feed response from cosmos service
- public override async Task ReadNextAsync(CancellationToken cancellationToken = default(CancellationToken))
+ public override async Task ReadNextAsync(CancellationToken cancellationToken = default)
{
ResponseMessage responseMessage = await this.clientContext.ProcessResourceOperationStreamAsync(
cosmosContainerCore: this.container,
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedRangeExtractor.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedRangeExtractor.cs
index 79d674d24..5ad4053c9 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedRangeExtractor.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedRangeExtractor.cs
@@ -14,15 +14,29 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
{
}
- public override FeedRange Visit(ChangeFeedStartFromNow startFromNow) => startFromNow.FeedRange;
+ public override FeedRange Visit(ChangeFeedStartFromNow startFromNow)
+ {
+ return startFromNow.FeedRange;
+ }
- public override FeedRange Visit(ChangeFeedStartFromTime startFromTime) => startFromTime.FeedRange;
+ public override FeedRange Visit(ChangeFeedStartFromTime startFromTime)
+ {
+ return startFromTime.FeedRange;
+ }
public override FeedRange Visit(ChangeFeedStartFromContinuation startFromContinuation)
- => throw new NotSupportedException($"{nameof(ChangeFeedStartFromContinuation)} does not have a feed range.");
+ {
+ throw new NotSupportedException($"{nameof(ChangeFeedStartFromContinuation)} does not have a feed range.");
+ }
- public override FeedRange Visit(ChangeFeedStartFromBeginning startFromBeginning) => startFromBeginning.FeedRange;
+ public override FeedRange Visit(ChangeFeedStartFromBeginning startFromBeginning)
+ {
+ return startFromBeginning.FeedRange;
+ }
- public override FeedRange Visit(ChangeFeedStartFromContinuationAndFeedRange startFromContinuationAndFeedRange) => startFromContinuationAndFeedRange.FeedRange;
+ public override FeedRange Visit(ChangeFeedStartFromContinuationAndFeedRange startFromContinuationAndFeedRange)
+ {
+ return startFromContinuationAndFeedRange.FeedRange;
+ }
}
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFrom.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFrom.cs
index 8de9024bc..7f121af91 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFrom.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFrom.cs
@@ -34,7 +34,10 @@ namespace Microsoft.Azure.Cosmos
/// Creates a that tells the ChangeFeed operation to start reading changes from this moment onward.
///
/// A that tells the ChangeFeed operation to start reading changes from this moment onward.
- public static ChangeFeedStartFrom Now() => Now(FeedRangeEpk.FullRange);
+ public static ChangeFeedStartFrom Now()
+ {
+ return Now(FeedRangeEpk.FullRange);
+ }
///
/// Creates a that tells the ChangeFeed operation to start reading changes from this moment onward.
@@ -56,7 +59,10 @@ namespace Microsoft.Azure.Cosmos
///
/// The time (in UTC) to start reading from.
/// A that tells the ChangeFeed operation to start reading changes from some point in time onward.
- public static ChangeFeedStartFrom Time(DateTime dateTimeUtc) => Time(dateTimeUtc, FeedRangeEpk.FullRange);
+ public static ChangeFeedStartFrom Time(DateTime dateTimeUtc)
+ {
+ return Time(dateTimeUtc, FeedRangeEpk.FullRange);
+ }
///
/// Creates a that tells the ChangeFeed operation to start reading changes from some point in time onward.
@@ -79,13 +85,19 @@ namespace Microsoft.Azure.Cosmos
///
/// The continuation to resume from.
/// A that tells the ChangeFeed operation to start reading changes from a save point.
- public static ChangeFeedStartFrom ContinuationToken(string continuationToken) => new ChangeFeedStartFromContinuation(continuationToken);
+ public static ChangeFeedStartFrom ContinuationToken(string continuationToken)
+ {
+ return new ChangeFeedStartFromContinuation(continuationToken);
+ }
///
/// Creates a that tells the ChangeFeed operation to start from the beginning of time.
///
/// A that tells the ChangeFeed operation to start reading changes from the beginning of time.
- public static ChangeFeedStartFrom Beginning() => Beginning(FeedRangeEpk.FullRange);
+ public static ChangeFeedStartFrom Beginning()
+ {
+ return Beginning(FeedRangeEpk.FullRange);
+ }
///
/// Creates a that tells the ChangeFeed operation to start from the beginning of time.
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromBeginning.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromBeginning.cs
index 643a122a0..74639910b 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromBeginning.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromBeginning.cs
@@ -26,8 +26,14 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
///
public FeedRangeInternal FeedRange { get; }
- internal override void Accept(ChangeFeedStartFromVisitor visitor) => visitor.Visit(this);
+ internal override void Accept(ChangeFeedStartFromVisitor visitor)
+ {
+ visitor.Visit(this);
+ }
- internal override TResult Accept(ChangeFeedStartFromVisitor visitor) => visitor.Visit(this);
+ internal override TResult Accept(ChangeFeedStartFromVisitor visitor)
+ {
+ return visitor.Visit(this);
+ }
}
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromContinuation.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromContinuation.cs
index feabbad1b..eadebfdbb 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromContinuation.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromContinuation.cs
@@ -32,8 +32,14 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
///
public string Continuation { get; }
- internal override void Accept(ChangeFeedStartFromVisitor visitor) => visitor.Visit(this);
+ internal override void Accept(ChangeFeedStartFromVisitor visitor)
+ {
+ visitor.Visit(this);
+ }
- internal override TResult Accept(ChangeFeedStartFromVisitor visitor) => visitor.Visit(this);
+ internal override TResult Accept(ChangeFeedStartFromVisitor visitor)
+ {
+ return visitor.Visit(this);
+ }
}
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromContinuationAndFeedRange.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromContinuationAndFeedRange.cs
index c07bcc270..80a55b167 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromContinuationAndFeedRange.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromContinuationAndFeedRange.cs
@@ -21,8 +21,14 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
public FeedRangeInternal FeedRange { get; }
- internal override void Accept(ChangeFeedStartFromVisitor visitor) => visitor.Visit(this);
+ internal override void Accept(ChangeFeedStartFromVisitor visitor)
+ {
+ visitor.Visit(this);
+ }
- internal override TResult Accept(ChangeFeedStartFromVisitor visitor) => visitor.Visit(this);
+ internal override TResult Accept(ChangeFeedStartFromVisitor visitor)
+ {
+ return visitor.Visit(this);
+ }
}
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromNow.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromNow.cs
index 598ac1cae..0111012f7 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromNow.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromNow.cs
@@ -26,8 +26,14 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
///
public FeedRangeInternal FeedRange { get; }
- internal override void Accept(ChangeFeedStartFromVisitor visitor) => visitor.Visit(this);
+ internal override void Accept(ChangeFeedStartFromVisitor visitor)
+ {
+ visitor.Visit(this);
+ }
- internal override TResult Accept(ChangeFeedStartFromVisitor visitor) => visitor.Visit(this);
+ internal override TResult Accept(ChangeFeedStartFromVisitor visitor)
+ {
+ return visitor.Visit(this);
+ }
}
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromTime.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromTime.cs
index 26aeb1771..b8f83a38a 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromTime.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFromTime.cs
@@ -38,8 +38,14 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
///
public FeedRangeInternal FeedRange { get; }
- internal override void Accept(ChangeFeedStartFromVisitor visitor) => visitor.Visit(this);
+ internal override void Accept(ChangeFeedStartFromVisitor visitor)
+ {
+ visitor.Visit(this);
+ }
- internal override TResult Accept(ChangeFeedStartFromVisitor visitor) => visitor.Visit(this);
+ internal override TResult Accept(ChangeFeedStartFromVisitor visitor)
+ {
+ return visitor.Visit(this);
+ }
}
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedContinuationToken.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedContinuationToken.cs
index 07ddc8cc8..e560be0e6 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedContinuationToken.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedContinuationToken.cs
@@ -44,10 +44,21 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
string minInclusive,
string maxExclusive)
{
- if (string.IsNullOrWhiteSpace(containerRid)) throw new ArgumentNullException(nameof(containerRid));
+ if (string.IsNullOrWhiteSpace(containerRid))
+ {
+ throw new ArgumentNullException(nameof(containerRid));
+ }
// MinInclusive can be an empty string
- if (minInclusive == null) throw new ArgumentNullException(nameof(minInclusive));
- if (string.IsNullOrWhiteSpace(maxExclusive)) throw new ArgumentNullException(nameof(maxExclusive));
+ if (minInclusive == null)
+ {
+ throw new ArgumentNullException(nameof(minInclusive));
+ }
+
+ if (string.IsNullOrWhiteSpace(maxExclusive))
+ {
+ throw new ArgumentNullException(nameof(maxExclusive));
+ }
+
return StandByFeedContinuationToken.SerializeTokens(new CompositeContinuationToken[1] { StandByFeedContinuationToken.CreateCompositeContinuationTokenForRange(minInclusive, maxExclusive, null) });
}
@@ -66,8 +77,15 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
string initialStandByFeedContinuationToken,
PartitionKeyRangeCacheDelegate pkRangeCacheDelegate)
{
- if (string.IsNullOrWhiteSpace(containerRid)) throw new ArgumentNullException(nameof(containerRid));
- if (pkRangeCacheDelegate == null) throw new ArgumentNullException(nameof(pkRangeCacheDelegate));
+ if (string.IsNullOrWhiteSpace(containerRid))
+ {
+ throw new ArgumentNullException(nameof(containerRid));
+ }
+
+ if (pkRangeCacheDelegate == null)
+ {
+ throw new ArgumentNullException(nameof(pkRangeCacheDelegate));
+ }
this.containerRid = containerRid;
this.pkRangeCacheDelegate = pkRangeCacheDelegate;
@@ -118,7 +136,10 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
private void HandleSplit(IReadOnlyList keyRanges)
{
- if (keyRanges == null) throw new ArgumentNullException(nameof(keyRanges));
+ if (keyRanges == null)
+ {
+ throw new ArgumentNullException(nameof(keyRanges));
+ }
// Update current
Documents.PartitionKeyRange firstRange = keyRanges[0];
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs
index 1c3b8fb96..0531c4d0b 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs
@@ -34,7 +34,10 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
ChangeFeedStartFrom changeFeedStartFrom,
ChangeFeedRequestOptions options)
{
- if (container == null) throw new ArgumentNullException(nameof(container));
+ if (container == null)
+ {
+ throw new ArgumentNullException(nameof(container));
+ }
this.clientContext = clientContext;
this.container = container;
@@ -54,7 +57,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
///
/// (Optional) representing request cancellation.
/// A query response from cosmos service
- public override async Task ReadNextAsync(CancellationToken cancellationToken = default(CancellationToken))
+ public override async Task ReadNextAsync(CancellationToken cancellationToken = default)
{
string firstNotModifiedKeyRangeId = null;
string currentKeyRangeId;
@@ -153,7 +156,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
///
internal async Task ShouldRetryFailureAsync(
ResponseMessage response,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
if (response.IsSuccessStatusCode || response.StatusCode == HttpStatusCode.NotModified)
{
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedOptions.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedOptions.cs
index 4294051f7..45f43fb51 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedOptions.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedOptions.cs
@@ -89,10 +89,7 @@ namespace Microsoft.Azure.Cosmos
///
public DateTime? StartTime
{
- get
- {
- return this.startTime;
- }
+ get => this.startTime;
set
{
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Bootstrapping/BootstrapperCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Bootstrapping/BootstrapperCore.cs
index ee389843b..e317a64e7 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Bootstrapping/BootstrapperCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Bootstrapping/BootstrapperCore.cs
@@ -22,10 +22,25 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.Bootstrapping
public BootstrapperCore(PartitionSynchronizer synchronizer, DocumentServiceLeaseStore leaseStore, TimeSpan lockTime, TimeSpan sleepTime)
{
- if (synchronizer == null) throw new ArgumentNullException(nameof(synchronizer));
- if (leaseStore == null) throw new ArgumentNullException(nameof(leaseStore));
- if (lockTime <= TimeSpan.Zero) throw new ArgumentException("should be positive", nameof(lockTime));
- if (sleepTime <= TimeSpan.Zero) throw new ArgumentException("should be positive", nameof(sleepTime));
+ if (synchronizer == null)
+ {
+ throw new ArgumentNullException(nameof(synchronizer));
+ }
+
+ if (leaseStore == null)
+ {
+ throw new ArgumentNullException(nameof(leaseStore));
+ }
+
+ if (lockTime <= TimeSpan.Zero)
+ {
+ throw new ArgumentException("should be positive", nameof(lockTime));
+ }
+
+ if (sleepTime <= TimeSpan.Zero)
+ {
+ throw new ArgumentException("should be positive", nameof(sleepTime));
+ }
this.synchronizer = synchronizer;
this.leaseStore = leaseStore;
@@ -38,7 +53,10 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.Bootstrapping
while (true)
{
bool initialized = await this.leaseStore.IsInitializedAsync().ConfigureAwait(false);
- if (initialized) break;
+ if (initialized)
+ {
+ break;
+ }
bool isLockAcquired = await this.leaseStore.AcquireInitializationLockAsync(this.lockTime).ConfigureAwait(false);
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorCore.cs
index 3aed14db3..1384efdfb 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorCore.cs
@@ -37,8 +37,15 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
ChangesEstimationHandler initialEstimateDelegate,
TimeSpan? estimatorPeriod)
{
- if (initialEstimateDelegate == null) throw new ArgumentNullException(nameof(initialEstimateDelegate));
- if (estimatorPeriod.HasValue && estimatorPeriod.Value <= TimeSpan.Zero) throw new ArgumentOutOfRangeException(nameof(estimatorPeriod));
+ if (initialEstimateDelegate == null)
+ {
+ throw new ArgumentNullException(nameof(initialEstimateDelegate));
+ }
+
+ if (estimatorPeriod.HasValue && estimatorPeriod.Value <= TimeSpan.Zero)
+ {
+ throw new ArgumentOutOfRangeException(nameof(estimatorPeriod));
+ }
this.initialEstimateDelegate = initialEstimateDelegate;
this.estimatorPeriod = estimatorPeriod;
@@ -62,8 +69,15 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
ChangeFeedProcessorOptions changeFeedProcessorOptions,
ContainerInternal monitoredContainer)
{
- if (monitoredContainer == null) throw new ArgumentNullException(nameof(monitoredContainer));
- if (leaseContainer == null && customDocumentServiceLeaseStoreManager == null) throw new ArgumentNullException(nameof(leaseContainer));
+ if (monitoredContainer == null)
+ {
+ throw new ArgumentNullException(nameof(monitoredContainer));
+ }
+
+ if (leaseContainer == null && customDocumentServiceLeaseStoreManager == null)
+ {
+ throw new ArgumentNullException(nameof(leaseContainer));
+ }
this.documentServiceLeaseStoreManager = customDocumentServiceLeaseStoreManager;
this.leaseContainer = leaseContainer;
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorBuilder.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorBuilder.cs
index 32841ba10..5271eea93 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorBuilder.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorBuilder.cs
@@ -46,8 +46,10 @@ namespace Microsoft.Azure.Cosmos
ChangeFeedProcessorOptions,
ContainerInternal> applyBuilderConfiguration)
{
- this.changeFeedLeaseOptions = new ChangeFeedLeaseOptions();
- this.changeFeedLeaseOptions.LeasePrefix = processorName;
+ this.changeFeedLeaseOptions = new ChangeFeedLeaseOptions
+ {
+ LeasePrefix = processorName
+ };
this.monitoredContainer = container;
this.changeFeedProcessor = changeFeedProcessor;
this.applyBuilderConfiguration = applyBuilderConfiguration;
@@ -92,7 +94,10 @@ namespace Microsoft.Azure.Cosmos
/// The instance of to use.
public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval)
{
- if (pollInterval == null) throw new ArgumentNullException(nameof(pollInterval));
+ if (pollInterval == null)
+ {
+ throw new ArgumentNullException(nameof(pollInterval));
+ }
this.changeFeedProcessorOptions = this.changeFeedProcessorOptions ?? new ChangeFeedProcessorOptions();
this.changeFeedProcessorOptions.FeedPollDelay = pollInterval;
@@ -130,7 +135,10 @@ namespace Microsoft.Azure.Cosmos
/// The instance of to use.
public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime)
{
- if (startTime == null) throw new ArgumentNullException(nameof(startTime));
+ if (startTime == null)
+ {
+ throw new ArgumentNullException(nameof(startTime));
+ }
this.changeFeedProcessorOptions = this.changeFeedProcessorOptions ?? new ChangeFeedProcessorOptions();
this.changeFeedProcessorOptions.StartTime = startTime;
@@ -144,7 +152,10 @@ namespace Microsoft.Azure.Cosmos
/// An instance of .
public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount)
{
- if (maxItemCount <= 0) throw new ArgumentOutOfRangeException(nameof(maxItemCount));
+ if (maxItemCount <= 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(maxItemCount));
+ }
this.changeFeedProcessorOptions = this.changeFeedProcessorOptions ?? new ChangeFeedProcessorOptions();
this.changeFeedProcessorOptions.MaxItemCount = maxItemCount;
@@ -158,9 +169,20 @@ namespace Microsoft.Azure.Cosmos
/// The instance of to use.
public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer)
{
- if (leaseContainer == null) throw new ArgumentNullException(nameof(leaseContainer));
- if (this.leaseContainer != null) throw new InvalidOperationException("The builder already defined a lease container.");
- if (this.LeaseStoreManager != null) throw new InvalidOperationException("The builder already defined an in-memory lease container instance.");
+ if (leaseContainer == null)
+ {
+ throw new ArgumentNullException(nameof(leaseContainer));
+ }
+
+ if (this.leaseContainer != null)
+ {
+ throw new InvalidOperationException("The builder already defined a lease container.");
+ }
+
+ if (this.LeaseStoreManager != null)
+ {
+ throw new InvalidOperationException("The builder already defined an in-memory lease container instance.");
+ }
this.leaseContainer = (ContainerInternal)leaseContainer;
return this;
@@ -175,8 +197,15 @@ namespace Microsoft.Azure.Cosmos
/// The instance of to use.
internal virtual ChangeFeedProcessorBuilder WithInMemoryLeaseContainer()
{
- if (this.leaseContainer != null) throw new InvalidOperationException("The builder already defined a lease container.");
- if (this.LeaseStoreManager != null) throw new InvalidOperationException("The builder already defined an in-memory lease container instance.");
+ if (this.leaseContainer != null)
+ {
+ throw new InvalidOperationException("The builder already defined a lease container.");
+ }
+
+ if (this.LeaseStoreManager != null)
+ {
+ throw new InvalidOperationException("The builder already defined an in-memory lease container instance.");
+ }
if (string.IsNullOrEmpty(this.InstanceName))
{
@@ -204,7 +233,10 @@ namespace Microsoft.Azure.Cosmos
internal virtual ChangeFeedProcessorBuilder WithMonitoredContainerRid(string monitoredContainerRid)
{
- if (monitoredContainerRid != null) throw new ArgumentNullException(nameof(monitoredContainerRid));
+ if (monitoredContainerRid != null)
+ {
+ throw new ArgumentNullException(nameof(monitoredContainerRid));
+ }
this.monitoredContainerRid = monitoredContainerRid;
return this;
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorCore.cs
index 001943e7d..f0e11c572 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorCore.cs
@@ -30,7 +30,10 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
public ChangeFeedProcessorCore(ChangeFeedObserverFactory observerFactory)
{
- if (observerFactory == null) throw new ArgumentNullException(nameof(observerFactory));
+ if (observerFactory == null)
+ {
+ throw new ArgumentNullException(nameof(observerFactory));
+ }
this.observerFactory = observerFactory;
}
@@ -44,9 +47,20 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
ChangeFeedProcessorOptions changeFeedProcessorOptions,
ContainerInternal monitoredContainer)
{
- if (monitoredContainer == null) throw new ArgumentNullException(nameof(monitoredContainer));
- if (customDocumentServiceLeaseStoreManager == null && leaseContainer == null) throw new ArgumentNullException(nameof(leaseContainer));
- if (instanceName == null) throw new ArgumentNullException("InstanceName is required for the processor to initialize.");
+ if (monitoredContainer == null)
+ {
+ throw new ArgumentNullException(nameof(monitoredContainer));
+ }
+
+ if (customDocumentServiceLeaseStoreManager == null && leaseContainer == null)
+ {
+ throw new ArgumentNullException(nameof(leaseContainer));
+ }
+
+ if (instanceName == null)
+ {
+ throw new ArgumentNullException("InstanceName is required for the processor to initialize.");
+ }
this.documentServiceLeaseStoreManager = customDocumentServiceLeaseStoreManager;
this.leaseContainer = leaseContainer;
@@ -109,7 +123,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
}
RequestOptionsFactory requestOptionsFactory = isPartitioned && !isMigratedFixed ?
- (RequestOptionsFactory)new PartitionedByIdCollectionRequestOptionsFactory() :
+ new PartitionedByIdCollectionRequestOptionsFactory() :
(RequestOptionsFactory)new SinglePartitionRequestOptionsFactory();
DocumentServiceLeaseStoreManagerBuilder leaseStoreManagerBuilder = new DocumentServiceLeaseStoreManagerBuilder()
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Configuration/ChangeFeedProcessorOptions.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Configuration/ChangeFeedProcessorOptions.cs
index 9d74f0b8d..28d4aff36 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Configuration/ChangeFeedProcessorOptions.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Configuration/ChangeFeedProcessorOptions.cs
@@ -64,15 +64,15 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.Configuration
///
public DateTime? StartTime
{
- get
- {
- return this.startTime;
- }
+ get => this.startTime;
set
{
if (value.HasValue && value.Value.Kind == DateTimeKind.Unspecified)
+ {
throw new ArgumentException("StartTime cannot have DateTimeKind.Unspecified", nameof(value));
+ }
+
this.startTime = value;
}
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/DocDBErrors/SubStatusHelpers.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/DocDBErrors/SubStatusHelpers.cs
index 1f98fbd0c..0542005f2 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/DocDBErrors/SubStatusHelpers.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/DocDBErrors/SubStatusHelpers.cs
@@ -16,9 +16,10 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.DocDBErrors
string valueSubStatus = exception.ResponseHeaders.Get(subStatusHeaderName);
if (!string.IsNullOrEmpty(valueSubStatus))
{
- int subStatusCode;
- if (int.TryParse(valueSubStatus, NumberStyles.Integer, CultureInfo.InvariantCulture, out subStatusCode))
+ if (int.TryParse(valueSubStatus, NumberStyles.Integer, CultureInfo.InvariantCulture, out int subStatusCode))
+ {
return (SubStatusCodes)subStatusCode;
+ }
}
return SubStatusCodes.Unknown;
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/EqualPartitionsBalancingStrategy.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/EqualPartitionsBalancingStrategy.cs
index bf44367da..7a5f4ac10 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/EqualPartitionsBalancingStrategy.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/EqualPartitionsBalancingStrategy.cs
@@ -23,7 +23,11 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
public EqualPartitionsBalancingStrategy(string hostName, int minPartitionCount, int maxPartitionCount, TimeSpan leaseExpirationInterval)
{
- if (hostName == null) throw new ArgumentNullException(nameof(hostName));
+ if (hostName == null)
+ {
+ throw new ArgumentNullException(nameof(hostName));
+ }
+
this.hostName = hostName;
this.minPartitionCount = minPartitionCount;
this.maxPartitionCount = maxPartitionCount;
@@ -32,15 +36,17 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
public override IEnumerable SelectLeasesToTake(IEnumerable allLeases)
{
- var workerToPartitionCount = new Dictionary();
- var expiredLeases = new List();
- var allPartitions = new Dictionary();
+ Dictionary workerToPartitionCount = new Dictionary();
+ List expiredLeases = new List();
+ Dictionary allPartitions = new Dictionary();
this.CategorizeLeases(allLeases, allPartitions, expiredLeases, workerToPartitionCount);
int partitionCount = allPartitions.Count;
int workerCount = workerToPartitionCount.Count;
if (partitionCount <= 0)
+ {
return Enumerable.Empty();
+ }
int target = this.CalculateTargetPartitionCount(partitionCount, workerCount);
int myCount = workerToPartitionCount[this.hostName];
@@ -59,7 +65,9 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
Math.Max(partitionsNeededForMe, 0));
if (partitionsNeededForMe <= 0)
+ {
return Enumerable.Empty();
+ }
if (expiredLeases.Count > 0)
{
@@ -101,7 +109,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
private int CalculateTargetPartitionCount(int partitionCount, int workerCount)
{
- var target = 1;
+ int target = 1;
if (partitionCount > workerCount)
{
target = (int)Math.Ceiling((double)partitionCount / workerCount);
@@ -138,9 +146,8 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
}
else
{
- var count = 0;
string assignedTo = lease.Owner;
- if (workerToPartitionCount.TryGetValue(assignedTo, out count))
+ if (workerToPartitionCount.TryGetValue(assignedTo, out int count))
{
workerToPartitionCount[assignedTo] = count + 1;
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/LeaseRenewerCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/LeaseRenewerCore.cs
index 5955802af..da8e74de9 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/LeaseRenewerCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/LeaseRenewerCore.cs
@@ -53,8 +53,11 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
{
try
{
- var renewedLease = await this.leaseManager.RenewAsync(this.lease).ConfigureAwait(false);
- if (renewedLease != null) this.lease = renewedLease;
+ DocumentServiceLease renewedLease = await this.leaseManager.RenewAsync(this.lease).ConfigureAwait(false);
+ if (renewedLease != null)
+ {
+ this.lease = renewedLease;
+ }
DefaultTrace.TraceInformation("Lease with token {0}: renewed lease with result {1}", this.lease.CurrentLeaseToken, renewedLease != null);
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionControllerCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionControllerCore.cs
index cc5d91cc0..2ff841a37 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionControllerCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionControllerCore.cs
@@ -57,7 +57,11 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
try
{
DocumentServiceLease updatedLease = await this.leaseManager.AcquireAsync(lease).ConfigureAwait(false);
- if (updatedLease != null) lease = updatedLease;
+ if (updatedLease != null)
+ {
+ lease = updatedLease;
+ }
+
DefaultTrace.TraceInformation("Lease with token {0}: acquired", lease.CurrentLeaseToken);
}
catch (Exception)
@@ -92,8 +96,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
private async Task RemoveLeaseAsync(DocumentServiceLease lease)
{
- TaskCompletionSource worker;
- if (!this.currentlyOwnedPartitions.TryRemove(lease.CurrentLeaseToken, out worker))
+ if (!this.currentlyOwnedPartitions.TryRemove(lease.CurrentLeaseToken, out TaskCompletionSource worker))
{
return;
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionLoadBalancerCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionLoadBalancerCore.cs
index 9de8e0438..1516d142d 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionLoadBalancerCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionLoadBalancerCore.cs
@@ -26,9 +26,20 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
LoadBalancingStrategy partitionLoadBalancingStrategy,
TimeSpan leaseAcquireInterval)
{
- if (partitionController == null) throw new ArgumentNullException(nameof(partitionController));
- if (leaseContainer == null) throw new ArgumentNullException(nameof(leaseContainer));
- if (partitionLoadBalancingStrategy == null) throw new ArgumentNullException(nameof(partitionLoadBalancingStrategy));
+ if (partitionController == null)
+ {
+ throw new ArgumentNullException(nameof(partitionController));
+ }
+
+ if (leaseContainer == null)
+ {
+ throw new ArgumentNullException(nameof(leaseContainer));
+ }
+
+ if (partitionLoadBalancingStrategy == null)
+ {
+ throw new ArgumentNullException(nameof(partitionLoadBalancingStrategy));
+ }
this.partitionController = partitionController;
this.leaseContainer = leaseContainer;
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/RemainingLeaseTokenWork.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/RemainingLeaseTokenWork.cs
index 1207ee304..181597ba3 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/RemainingLeaseTokenWork.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/RemainingLeaseTokenWork.cs
@@ -18,7 +18,10 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
/// The amount of documents remaining to be processed
public RemainingLeaseTokenWork(string leaseToken, long remainingWork)
{
- if (string.IsNullOrEmpty(leaseToken)) throw new ArgumentNullException(nameof(leaseToken));
+ if (string.IsNullOrEmpty(leaseToken))
+ {
+ throw new ArgumentNullException(nameof(leaseToken));
+ }
this.LeaseToken = leaseToken;
this.RemainingWork = remainingWork;
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/RemainingWorkEstimatorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/RemainingWorkEstimatorCore.cs
index ebde58b00..fed7c87f5 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/RemainingWorkEstimatorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/RemainingWorkEstimatorCore.cs
@@ -17,7 +17,6 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
using Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement;
using Microsoft.Azure.Cosmos.ChangeFeed.Utils;
using Microsoft.Azure.Cosmos.Core.Trace;
- using Microsoft.Azure.Cosmos.Query.Core;
using Microsoft.Azure.Documents;
using Newtonsoft.Json.Linq;
@@ -58,7 +57,10 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
public override async Task GetEstimatedRemainingWorkAsync(CancellationToken cancellationToken)
{
IReadOnlyList leaseTokens = await this.GetEstimatedRemainingWorkPerLeaseTokenAsync(cancellationToken);
- if (leaseTokens.Count == 0) return 1;
+ if (leaseTokens.Count == 0)
+ {
+ return 1;
+ }
return leaseTokens.Sum(leaseToken => leaseToken.RemainingWork);
}
@@ -83,7 +85,11 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
DocumentServiceLease item = partition.Current;
try
{
- if (string.IsNullOrEmpty(item?.CurrentLeaseToken)) continue;
+ if (string.IsNullOrEmpty(item?.CurrentLeaseToken))
+ {
+ continue;
+ }
+
long result = await this.GetRemainingWorkAsync(item, cancellationToken);
partialResults.Add(new RemainingLeaseTokenWork(item.CurrentLeaseToken, result));
}
@@ -158,8 +164,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedManagement
private static long TryConvertToNumber(string number)
{
- long parsed = 0;
- if (!long.TryParse(number, NumberStyles.Number, CultureInfo.InvariantCulture, out parsed))
+ if (!long.TryParse(number, NumberStyles.Number, CultureInfo.InvariantCulture, out long parsed))
{
DefaultTrace.TraceWarning("Cannot parse number '{0}'.", number);
return 0;
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/AutoCheckpointer.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/AutoCheckpointer.cs
index c90e7de54..616990aaa 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/AutoCheckpointer.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/AutoCheckpointer.cs
@@ -20,9 +20,14 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing
public AutoCheckpointer(CheckpointFrequency checkpointFrequency, ChangeFeedObserver observer)
{
if (checkpointFrequency == null)
+ {
throw new ArgumentNullException(nameof(checkpointFrequency));
+ }
+
if (observer == null)
+ {
throw new ArgumentNullException(nameof(observer));
+ }
this.checkpointFrequency = checkpointFrequency;
this.observer = observer;
@@ -59,11 +64,15 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing
}
if (this.processedDocCount >= this.checkpointFrequency.ProcessedDocumentCount)
+ {
return true;
+ }
TimeSpan delta = DateTime.UtcNow - this.lastCheckpointTime;
if (delta >= this.checkpointFrequency.TimeInterval)
+ {
return true;
+ }
return false;
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/CheckpointerObserverFactory.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/CheckpointerObserverFactory.cs
index 0a8c56885..2d93d3d7f 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/CheckpointerObserverFactory.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/CheckpointerObserverFactory.cs
@@ -23,9 +23,14 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing
public CheckpointerObserverFactory(ChangeFeedObserverFactory observerFactory, CheckpointFrequency checkpointFrequency)
{
if (observerFactory == null)
+ {
throw new ArgumentNullException(nameof(observerFactory));
+ }
+
if (checkpointFrequency == null)
+ {
throw new ArgumentNullException(nameof(checkpointFrequency));
+ }
this.observerFactory = observerFactory;
this.checkpointFrequency = checkpointFrequency;
@@ -38,7 +43,10 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing
public override ChangeFeedObserver CreateObserver()
{
ChangeFeedObserver observer = new ObserverExceptionWrappingChangeFeedObserverDecorator(this.observerFactory.CreateObserver());
- if (this.checkpointFrequency.ExplicitCheckpoint) return observer;
+ if (this.checkpointFrequency.ExplicitCheckpoint)
+ {
+ return observer;
+ }
return new AutoCheckpointer(this.checkpointFrequency, observer);
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/FeedEstimatorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/FeedEstimatorCore.cs
index 5218d2265..648b4ec37 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/FeedEstimatorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/FeedEstimatorCore.cs
@@ -37,7 +37,9 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.FeedProcessing
catch (TaskCanceledException canceledException)
{
if (cancellationToken.IsCancellationRequested)
+ {
throw;
+ }
Extensions.TraceException(new Exception("exception within estimator", canceledException));
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Utils/CosmosContainerExtensions.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Utils/CosmosContainerExtensions.cs
index c5ce32f2e..e03fb799e 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Utils/CosmosContainerExtensions.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Utils/CosmosContainerExtensions.cs
@@ -96,7 +96,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.Utils
public static async Task GetMonitoredContainerRidAsync(
this Container monitoredContainer,
string suggestedMonitoredRid,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
if (!string.IsNullOrEmpty(suggestedMonitoredRid))
{
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Utils/ParallelHelper.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Utils/ParallelHelper.cs
index 9048eb427..6570e0153 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Utils/ParallelHelper.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Utils/ParallelHelper.cs
@@ -18,7 +18,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed.Utils
this IEnumerable source,
Func worker,
int maxParallelTaskCount = 0,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
Debug.Assert(source != null, "source is null");
Debug.Assert(worker != null, "worker is null");
diff --git a/Microsoft.Azure.Cosmos/src/ClientExtensions.cs b/Microsoft.Azure.Cosmos/src/ClientExtensions.cs
index 83c520700..62eeb9ff5 100644
--- a/Microsoft.Azure.Cosmos/src/ClientExtensions.cs
+++ b/Microsoft.Azure.Cosmos/src/ClientExtensions.cs
@@ -16,7 +16,7 @@ namespace Microsoft.Azure.Cosmos
public static async Task GetAsync(this HttpClient client,
Uri uri,
INameValueCollection additionalHeaders = null,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
if (uri == null) throw new ArgumentNullException("uri");
diff --git a/Microsoft.Azure.Cosmos/src/CosmosClient.cs b/Microsoft.Azure.Cosmos/src/CosmosClient.cs
index 63957bbf5..8448c3a3d 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosClient.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosClient.cs
@@ -5,9 +5,7 @@
namespace Microsoft.Azure.Cosmos
{
using System;
- using System.IO;
using System.Net;
- using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -376,7 +374,7 @@ namespace Microsoft.Azure.Cosmos
string id,
int? throughput = null,
RequestOptions requestOptions = null,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
if (string.IsNullOrEmpty(id))
{
@@ -388,16 +386,16 @@ namespace Microsoft.Azure.Cosmos
requestOptions,
(diagnostics) =>
{
- DatabaseProperties databaseProperties = this.PrepareDatabaseProperties(id);
- ThroughputProperties throughputProperties = ThroughputProperties.CreateManualThroughput(throughput);
+ DatabaseProperties databaseProperties = this.PrepareDatabaseProperties(id);
+ ThroughputProperties throughputProperties = ThroughputProperties.CreateManualThroughput(throughput);
- return this.CreateDatabaseInternalAsync(
- databaseProperties: databaseProperties,
- throughputProperties: throughputProperties,
- requestOptions: requestOptions,
- diagnosticsContext: diagnostics,
- cancellationToken: cancellationToken);
- });
+ return this.CreateDatabaseInternalAsync(
+ databaseProperties: databaseProperties,
+ throughputProperties: throughputProperties,
+ requestOptions: requestOptions,
+ diagnosticsContext: diagnostics,
+ cancellationToken: cancellationToken);
+ });
}
///
@@ -422,7 +420,7 @@ namespace Microsoft.Azure.Cosmos
string id,
ThroughputProperties throughputProperties,
RequestOptions requestOptions = null,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
if (string.IsNullOrEmpty(id))
{
@@ -480,14 +478,11 @@ namespace Microsoft.Azure.Cosmos
string id,
ThroughputProperties throughputProperties,
RequestOptions requestOptions = null,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
- if (string.IsNullOrEmpty(id))
- {
- throw new ArgumentNullException(nameof(id));
- }
-
- return this.ClientContext.OperationHelperAsync(
+ return string.IsNullOrEmpty(id)
+ ? throw new ArgumentNullException(nameof(id))
+ : this.ClientContext.OperationHelperAsync(
nameof(CreateDatabaseIfNotExistsAsync),
requestOptions,
async (diagnostics) =>
@@ -566,7 +561,7 @@ namespace Microsoft.Azure.Cosmos
string id,
int? throughput = null,
RequestOptions requestOptions = null,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
ThroughputProperties throughputProperties = ThroughputProperties.CreateManualThroughput(throughput);
@@ -806,7 +801,7 @@ namespace Microsoft.Azure.Cosmos
DatabaseProperties databaseProperties,
int? throughput = null,
RequestOptions requestOptions = null,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
if (databaseProperties == null)
{
@@ -875,7 +870,7 @@ namespace Microsoft.Azure.Cosmos
DatabaseProperties databaseProperties,
ThroughputProperties throughputProperties,
RequestOptions requestOptions = null,
- CancellationToken cancellationToken = default(CancellationToken))
+ CancellationToken cancellationToken = default)
{
if (databaseProperties == null)
{
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosBoolean.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosBoolean.cs
index 30e10b0bb..93e205ab9 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosBoolean.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosBoolean.cs
@@ -32,41 +32,86 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
public bool Value { get; }
- public override void Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override void Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ return cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input) => cosmosElementVisitor.Visit(this, input);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input)
+ {
+ return cosmosElementVisitor.Visit(this, input);
+ }
- public override bool Equals(CosmosElement cosmosElement) => cosmosElement is CosmosBoolean cosmosBoolean && this.Equals(cosmosBoolean);
+ public override bool Equals(CosmosElement cosmosElement)
+ {
+ return cosmosElement is CosmosBoolean cosmosBoolean && this.Equals(cosmosBoolean);
+ }
- public bool Equals(CosmosBoolean cosmosBoolean) => this.Value == cosmosBoolean.Value;
+ public bool Equals(CosmosBoolean cosmosBoolean)
+ {
+ return this.Value == cosmosBoolean.Value;
+ }
- public override int GetHashCode() => this.Value ? TrueHash : FalseHash;
+ public override int GetHashCode()
+ {
+ return this.Value ? TrueHash : FalseHash;
+ }
- public int CompareTo(CosmosBoolean cosmosBoolean) => this.Value.CompareTo(cosmosBoolean.Value);
+ public int CompareTo(CosmosBoolean cosmosBoolean)
+ {
+ return this.Value.CompareTo(cosmosBoolean.Value);
+ }
- public static CosmosBoolean Create(bool boolean) => boolean ? CosmosBoolean.True : CosmosBoolean.False;
+ public static CosmosBoolean Create(bool boolean)
+ {
+ return boolean ? CosmosBoolean.True : CosmosBoolean.False;
+ }
- public override void WriteTo(IJsonWriter jsonWriter) => jsonWriter.WriteBoolValue(this.Value);
+ public override void WriteTo(IJsonWriter jsonWriter)
+ {
+ jsonWriter.WriteBoolValue(this.Value);
+ }
- public static new CosmosBoolean CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.CreateFromBuffer(buffer);
+ public static new CosmosBoolean CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.CreateFromBuffer(buffer);
+ }
- public static new CosmosBoolean Parse(string json) => CosmosElement.Parse(json);
+ public static new CosmosBoolean Parse(string json)
+ {
+ return CosmosElement.Parse(json);
+ }
public static bool TryCreateFromBuffer(
ReadOnlyMemory buffer,
- out CosmosBoolean cosmosBoolean) => CosmosElement.TryCreateFromBuffer(buffer, out cosmosBoolean);
+ out CosmosBoolean cosmosBoolean)
+ {
+ return CosmosElement.TryCreateFromBuffer(buffer, out cosmosBoolean);
+ }
public static bool TryParse(
string json,
- out CosmosBoolean cosmosBoolean) => CosmosElement.TryParse(json, out cosmosBoolean);
+ out CosmosBoolean cosmosBoolean)
+ {
+ return CosmosElement.TryParse(json, out cosmosBoolean);
+ }
public static new class Monadic
{
- public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.Monadic.CreateFromBuffer(buffer);
+ public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.Monadic.CreateFromBuffer(buffer);
+ }
- public static TryCatch Parse(string json) => CosmosElement.Monadic.Parse(json);
+ public static TryCatch Parse(string json)
+ {
+ return CosmosElement.Monadic.Parse(json);
+ }
}
}
#if INTERNAL
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosElement.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosElement.cs
index 9d55ed8e4..0d7be9641 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosElement.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosElement.cs
@@ -41,11 +41,14 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return Utf8StringHelpers.ToString(jsonWriter.GetResult());
}
- public override bool Equals(object obj) => obj is CosmosElement cosmosElement && this.Equals(cosmosElement);
+ public override bool Equals(object obj)
+ {
+ return obj is CosmosElement cosmosElement && this.Equals(cosmosElement);
+ }
public abstract bool Equals(CosmosElement cosmosElement);
- public override abstract int GetHashCode();
+ public abstract override int GetHashCode();
public int CompareTo(CosmosElement other)
{
@@ -121,7 +124,10 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return TryCatch.FromResult(typedCosmosElement);
}
- public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.Monadic.CreateFromBuffer(buffer);
+ public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.Monadic.CreateFromBuffer(buffer);
+ }
public static TryCatch Parse(string serializedCosmosElement)
where TCosmosElement : CosmosElement
@@ -142,7 +148,10 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return CosmosElement.Monadic.CreateFromBuffer(buffer);
}
- public static TryCatch Parse(string serializedCosmosElement) => CosmosElement.Monadic.Parse(serializedCosmosElement);
+ public static TryCatch Parse(string serializedCosmosElement)
+ {
+ return CosmosElement.Monadic.Parse(serializedCosmosElement);
+ }
}
public static TCosmosElement CreateFromBuffer(ReadOnlyMemory buffer)
@@ -154,7 +163,10 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return tryCreateFromBuffer.Result;
}
- public static CosmosElement CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.CreateFromBuffer(buffer);
+ public static CosmosElement CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.CreateFromBuffer(buffer);
+ }
public static bool TryCreateFromBuffer(ReadOnlyMemory buffer, out TCosmosElement cosmosElement)
where TCosmosElement : CosmosElement
@@ -248,7 +260,10 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return a.Equals(b);
}
- public static bool operator !=(CosmosElement a, CosmosElement b) => !(a == b);
+ public static bool operator !=(CosmosElement a, CosmosElement b)
+ {
+ return !(a == b);
+ }
private sealed class CosmosElementToTypeOrder : ICosmosElementVisitor
{
@@ -258,14 +273,45 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
{
}
- public int Visit(CosmosNull cosmosNull) => 0;
- public int Visit(CosmosBoolean cosmosBoolean) => 1;
- public int Visit(CosmosNumber cosmosNumber) => 2;
- public int Visit(CosmosString cosmosString) => 3;
- public int Visit(CosmosArray cosmosArray) => 4;
- public int Visit(CosmosObject cosmosObject) => 5;
- public int Visit(CosmosGuid cosmosGuid) => 6;
- public int Visit(CosmosBinary cosmosBinary) => 7;
+ public int Visit(CosmosNull cosmosNull)
+ {
+ return 0;
+ }
+
+ public int Visit(CosmosBoolean cosmosBoolean)
+ {
+ return 1;
+ }
+
+ public int Visit(CosmosNumber cosmosNumber)
+ {
+ return 2;
+ }
+
+ public int Visit(CosmosString cosmosString)
+ {
+ return 3;
+ }
+
+ public int Visit(CosmosArray cosmosArray)
+ {
+ return 4;
+ }
+
+ public int Visit(CosmosObject cosmosObject)
+ {
+ return 5;
+ }
+
+ public int Visit(CosmosGuid cosmosGuid)
+ {
+ return 6;
+ }
+
+ public int Visit(CosmosBinary cosmosBinary)
+ {
+ return 7;
+ }
}
private sealed class CosmosElementWithinTypeComparer : ICosmosElementVisitor
@@ -276,14 +322,45 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
{
}
- public int Visit(CosmosArray cosmosArray, CosmosElement input) => cosmosArray.CompareTo((CosmosArray)input);
- public int Visit(CosmosBinary cosmosBinary, CosmosElement input) => cosmosBinary.CompareTo((CosmosBinary)input);
- public int Visit(CosmosBoolean cosmosBoolean, CosmosElement input) => cosmosBoolean.CompareTo((CosmosBoolean)input);
- public int Visit(CosmosGuid cosmosGuid, CosmosElement input) => cosmosGuid.CompareTo((CosmosGuid)input);
- public int Visit(CosmosNull cosmosNull, CosmosElement input) => cosmosNull.CompareTo((CosmosNull)input);
- public int Visit(CosmosNumber cosmosNumber, CosmosElement input) => cosmosNumber.CompareTo((CosmosNumber)input);
- public int Visit(CosmosObject cosmosObject, CosmosElement input) => cosmosObject.CompareTo((CosmosObject)input);
- public int Visit(CosmosString cosmosString, CosmosElement input) => cosmosString.CompareTo((CosmosString)input);
+ public int Visit(CosmosArray cosmosArray, CosmosElement input)
+ {
+ return cosmosArray.CompareTo((CosmosArray)input);
+ }
+
+ public int Visit(CosmosBinary cosmosBinary, CosmosElement input)
+ {
+ return cosmosBinary.CompareTo((CosmosBinary)input);
+ }
+
+ public int Visit(CosmosBoolean cosmosBoolean, CosmosElement input)
+ {
+ return cosmosBoolean.CompareTo((CosmosBoolean)input);
+ }
+
+ public int Visit(CosmosGuid cosmosGuid, CosmosElement input)
+ {
+ return cosmosGuid.CompareTo((CosmosGuid)input);
+ }
+
+ public int Visit(CosmosNull cosmosNull, CosmosElement input)
+ {
+ return cosmosNull.CompareTo((CosmosNull)input);
+ }
+
+ public int Visit(CosmosNumber cosmosNumber, CosmosElement input)
+ {
+ return cosmosNumber.CompareTo((CosmosNumber)input);
+ }
+
+ public int Visit(CosmosObject cosmosObject, CosmosElement input)
+ {
+ return cosmosObject.CompareTo((CosmosObject)input);
+ }
+
+ public int Visit(CosmosString cosmosString, CosmosElement input)
+ {
+ return cosmosString.CompareTo((CosmosString)input);
+ }
}
}
#if INTERNAL
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosGuid.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosGuid.cs
index ee5ea39a4..e11241f11 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosGuid.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosGuid.cs
@@ -28,15 +28,30 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
public abstract Guid Value { get; }
- public override void Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override void Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ return cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input) => cosmosElementVisitor.Visit(this, input);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input)
+ {
+ return cosmosElementVisitor.Visit(this, input);
+ }
- public override bool Equals(CosmosElement cosmosElement) => cosmosElement is CosmosGuid cosmosGuid && this.Equals(cosmosGuid);
+ public override bool Equals(CosmosElement cosmosElement)
+ {
+ return cosmosElement is CosmosGuid cosmosGuid && this.Equals(cosmosGuid);
+ }
- public bool Equals(CosmosGuid cosmosGuid) => this.Value == cosmosGuid.Value;
+ public bool Equals(CosmosGuid cosmosGuid)
+ {
+ return this.Value == cosmosGuid.Value;
+ }
public override int GetHashCode()
{
@@ -45,7 +60,10 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return (int)hash;
}
- public int CompareTo(CosmosGuid cosmosGuid) => this.Value.CompareTo(cosmosGuid.Value);
+ public int CompareTo(CosmosGuid cosmosGuid)
+ {
+ return this.Value.CompareTo(cosmosGuid.Value);
+ }
public static CosmosGuid Create(
IJsonNavigator jsonNavigator,
@@ -54,27 +72,51 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return new LazyCosmosGuid(jsonNavigator, jsonNavigatorNode);
}
- public static CosmosGuid Create(Guid value) => new EagerCosmosGuid(value);
+ public static CosmosGuid Create(Guid value)
+ {
+ return new EagerCosmosGuid(value);
+ }
- public override void WriteTo(IJsonWriter jsonWriter) => jsonWriter.WriteGuidValue(this.Value);
+ public override void WriteTo(IJsonWriter jsonWriter)
+ {
+ jsonWriter.WriteGuidValue(this.Value);
+ }
- public static new CosmosGuid CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.CreateFromBuffer(buffer);
+ public static new CosmosGuid CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.CreateFromBuffer(buffer);
+ }
- public static new CosmosGuid Parse(string json) => CosmosElement.Parse(json);
+ public static new CosmosGuid Parse(string json)
+ {
+ return CosmosElement.Parse(json);
+ }
public static bool TryCreateFromBuffer(
ReadOnlyMemory buffer,
- out CosmosGuid cosmosGuid) => CosmosElement.TryCreateFromBuffer(buffer, out cosmosGuid);
+ out CosmosGuid cosmosGuid)
+ {
+ return CosmosElement.TryCreateFromBuffer(buffer, out cosmosGuid);
+ }
public static bool TryParse(
string json,
- out CosmosGuid cosmosGuid) => CosmosElement.TryParse(json, out cosmosGuid);
+ out CosmosGuid cosmosGuid)
+ {
+ return CosmosElement.TryParse(json, out cosmosGuid);
+ }
public static new class Monadic
{
- public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.Monadic.CreateFromBuffer(buffer);
+ public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.Monadic.CreateFromBuffer(buffer);
+ }
- public static TryCatch Parse(string json) => CosmosElement.Monadic.Parse(json);
+ public static TryCatch Parse(string json)
+ {
+ return CosmosElement.Monadic.Parse(json);
+ }
}
}
#if INTERNAL
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosNull.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosNull.cs
index 6f41361bb..4f192d28e 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosNull.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosNull.cs
@@ -27,41 +27,86 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
{
}
- public override void Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override void Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ return cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input) => cosmosElementVisitor.Visit(this, input);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input)
+ {
+ return cosmosElementVisitor.Visit(this, input);
+ }
- public override bool Equals(CosmosElement cosmosElement) => cosmosElement is CosmosNull cosmosNull && this.Equals(cosmosNull);
+ public override bool Equals(CosmosElement cosmosElement)
+ {
+ return cosmosElement is CosmosNull cosmosNull && this.Equals(cosmosNull);
+ }
- public bool Equals(CosmosNull cosmosNull) => true;
+ public bool Equals(CosmosNull cosmosNull)
+ {
+ return true;
+ }
- public static CosmosNull Create() => CosmosNull.Singleton;
+ public static CosmosNull Create()
+ {
+ return CosmosNull.Singleton;
+ }
- public override int GetHashCode() => (int)Hash;
+ public override int GetHashCode()
+ {
+ return (int)Hash;
+ }
- public override void WriteTo(IJsonWriter jsonWriter) => jsonWriter.WriteNullValue();
+ public override void WriteTo(IJsonWriter jsonWriter)
+ {
+ jsonWriter.WriteNullValue();
+ }
- public static new CosmosNull CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.CreateFromBuffer(buffer);
+ public static new CosmosNull CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.CreateFromBuffer(buffer);
+ }
- public static new CosmosNull Parse(string json) => CosmosElement.Parse(json);
+ public static new CosmosNull Parse(string json)
+ {
+ return CosmosElement.Parse(json);
+ }
public static bool TryCreateFromBuffer(
ReadOnlyMemory buffer,
- out CosmosNull cosmosNull) => CosmosElement.TryCreateFromBuffer(buffer, out cosmosNull);
+ out CosmosNull cosmosNull)
+ {
+ return CosmosElement.TryCreateFromBuffer(buffer, out cosmosNull);
+ }
public static bool TryParse(
string json,
- out CosmosNull cosmosNull) => CosmosElement.TryParse(json, out cosmosNull);
+ out CosmosNull cosmosNull)
+ {
+ return CosmosElement.TryParse(json, out cosmosNull);
+ }
- public int CompareTo(CosmosNull other) => 0;
+ public int CompareTo(CosmosNull other)
+ {
+ return 0;
+ }
public static new class Monadic
{
- public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.Monadic.CreateFromBuffer(buffer);
+ public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.Monadic.CreateFromBuffer(buffer);
+ }
- public static TryCatch Parse(string json) => CosmosElement.Monadic.Parse(json);
+ public static TryCatch Parse(string json)
+ {
+ return CosmosElement.Monadic.Parse(json);
+ }
}
}
#if INTERNAL
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosNumber.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosNumber.cs
index 863b2c4e1..46e839dfe 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosNumber.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosNumber.cs
@@ -31,13 +31,25 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
public abstract TOutput Accept(ICosmosNumberVisitor cosmosNumberVisitor, TArg input);
- public override void Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override void Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ return cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input) => cosmosElementVisitor.Visit(this, input);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input)
+ {
+ return cosmosElementVisitor.Visit(this, input);
+ }
- public override bool Equals(CosmosElement cosmosElement) => cosmosElement is CosmosNumber cosmosNumber && this.Equals(cosmosNumber);
+ public override bool Equals(CosmosElement cosmosElement)
+ {
+ return cosmosElement is CosmosNumber cosmosNumber && this.Equals(cosmosNumber);
+ }
public abstract bool Equals(CosmosNumber cosmosNumber);
@@ -55,23 +67,41 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return this.Accept(CosmosNumberWithinTypeComparer.Singleton, other);
}
- public static new CosmosNumber CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.CreateFromBuffer(buffer);
+ public static new CosmosNumber CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.CreateFromBuffer(buffer);
+ }
- public static new CosmosNumber Parse(string json) => CosmosElement.Parse(json);
+ public static new CosmosNumber Parse(string json)
+ {
+ return CosmosElement.Parse(json);
+ }
public static bool TryCreateFromBuffer(
ReadOnlyMemory buffer,
- out CosmosNumber cosmosNumber) => CosmosElement.TryCreateFromBuffer(buffer, out cosmosNumber);
+ out CosmosNumber cosmosNumber)
+ {
+ return CosmosElement.TryCreateFromBuffer(buffer, out cosmosNumber);
+ }
public static bool TryParse(
string json,
- out CosmosNumber cosmosNumber) => CosmosElement.TryParse(json, out cosmosNumber);
+ out CosmosNumber cosmosNumber)
+ {
+ return CosmosElement.TryParse(json, out cosmosNumber);
+ }
public static new class Monadic
{
- public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.Monadic.CreateFromBuffer(buffer);
+ public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.Monadic.CreateFromBuffer(buffer);
+ }
- public static TryCatch Parse(string json) => CosmosElement.Monadic.Parse(json);
+ public static TryCatch Parse(string json)
+ {
+ return CosmosElement.Monadic.Parse(json);
+ }
}
private sealed class CosmosNumberToTypeOrder : ICosmosNumberVisitor
@@ -82,14 +112,45 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
{
}
- public int Visit(CosmosNumber64 cosmosNumber64) => 0;
- public int Visit(CosmosInt8 cosmosInt8) => 1;
- public int Visit(CosmosInt16 cosmosInt16) => 2;
- public int Visit(CosmosInt32 cosmosInt32) => 3;
- public int Visit(CosmosInt64 cosmosInt64) => 4;
- public int Visit(CosmosUInt32 cosmosUInt32) => 5;
- public int Visit(CosmosFloat32 cosmosFloat32) => 6;
- public int Visit(CosmosFloat64 cosmosFloat64) => 7;
+ public int Visit(CosmosNumber64 cosmosNumber64)
+ {
+ return 0;
+ }
+
+ public int Visit(CosmosInt8 cosmosInt8)
+ {
+ return 1;
+ }
+
+ public int Visit(CosmosInt16 cosmosInt16)
+ {
+ return 2;
+ }
+
+ public int Visit(CosmosInt32 cosmosInt32)
+ {
+ return 3;
+ }
+
+ public int Visit(CosmosInt64 cosmosInt64)
+ {
+ return 4;
+ }
+
+ public int Visit(CosmosUInt32 cosmosUInt32)
+ {
+ return 5;
+ }
+
+ public int Visit(CosmosFloat32 cosmosFloat32)
+ {
+ return 6;
+ }
+
+ public int Visit(CosmosFloat64 cosmosFloat64)
+ {
+ return 7;
+ }
}
private sealed class CosmosNumberWithinTypeComparer : ICosmosNumberVisitor
@@ -100,14 +161,45 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
{
}
- public int Visit(CosmosNumber64 cosmosNumber64, CosmosNumber input) => cosmosNumber64.CompareTo((CosmosNumber64)input);
- public int Visit(CosmosInt8 cosmosInt8, CosmosNumber input) => cosmosInt8.CompareTo((CosmosInt8)input);
- public int Visit(CosmosInt16 cosmosInt16, CosmosNumber input) => cosmosInt16.CompareTo((CosmosInt16)input);
- public int Visit(CosmosInt32 cosmosInt32, CosmosNumber input) => cosmosInt32.CompareTo((CosmosInt32)input);
- public int Visit(CosmosInt64 cosmosInt64, CosmosNumber input) => cosmosInt64.CompareTo((CosmosInt64)input);
- public int Visit(CosmosUInt32 cosmosUInt32, CosmosNumber input) => cosmosUInt32.CompareTo((CosmosUInt32)input);
- public int Visit(CosmosFloat32 cosmosFloat32, CosmosNumber input) => cosmosFloat32.CompareTo((CosmosFloat32)input);
- public int Visit(CosmosFloat64 cosmosFloat64, CosmosNumber input) => cosmosFloat64.CompareTo((CosmosFloat64)input);
+ public int Visit(CosmosNumber64 cosmosNumber64, CosmosNumber input)
+ {
+ return cosmosNumber64.CompareTo((CosmosNumber64)input);
+ }
+
+ public int Visit(CosmosInt8 cosmosInt8, CosmosNumber input)
+ {
+ return cosmosInt8.CompareTo((CosmosInt8)input);
+ }
+
+ public int Visit(CosmosInt16 cosmosInt16, CosmosNumber input)
+ {
+ return cosmosInt16.CompareTo((CosmosInt16)input);
+ }
+
+ public int Visit(CosmosInt32 cosmosInt32, CosmosNumber input)
+ {
+ return cosmosInt32.CompareTo((CosmosInt32)input);
+ }
+
+ public int Visit(CosmosInt64 cosmosInt64, CosmosNumber input)
+ {
+ return cosmosInt64.CompareTo((CosmosInt64)input);
+ }
+
+ public int Visit(CosmosUInt32 cosmosUInt32, CosmosNumber input)
+ {
+ return cosmosUInt32.CompareTo((CosmosUInt32)input);
+ }
+
+ public int Visit(CosmosFloat32 cosmosFloat32, CosmosNumber input)
+ {
+ return cosmosFloat32.CompareTo((CosmosFloat32)input);
+ }
+
+ public int Visit(CosmosFloat64 cosmosFloat64, CosmosNumber input)
+ {
+ return cosmosFloat64.CompareTo((CosmosFloat64)input);
+ }
}
}
#if INTERNAL
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.EagerCosmosObject.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.EagerCosmosObject.cs
index 6476b6556..114215c70 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.EagerCosmosObject.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.EagerCosmosObject.cs
@@ -47,9 +47,15 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
public override int Count => this.properties.Count;
- public override bool ContainsKey(string key) => this.TryGetValue(key, out _);
+ public override bool ContainsKey(string key)
+ {
+ return this.TryGetValue(key, out _);
+ }
- public override IEnumerator> GetEnumerator() => this.properties.GetEnumerator();
+ public override IEnumerator> GetEnumerator()
+ {
+ return this.properties.GetEnumerator();
+ }
public override bool TryGetValue(string key, out CosmosElement value)
{
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.LazyCosmosObject.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.LazyCosmosObject.cs
index a0c279a6e..9c52ca42f 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.LazyCosmosObject.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.LazyCosmosObject.cs
@@ -8,7 +8,6 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.Azure.Cosmos.Json;
@@ -69,20 +68,26 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
}
}
- public override bool ContainsKey(string key) => this.jsonNavigator.TryGetObjectProperty(
- this.jsonNavigatorNode,
- key,
- out _);
+ public override bool ContainsKey(string key)
+ {
+ return this.jsonNavigator.TryGetObjectProperty(
+this.jsonNavigatorNode,
+key,
+out _);
+ }
- public override IEnumerator> GetEnumerator() => this
- .jsonNavigator
- .GetObjectProperties(this.jsonNavigatorNode)
- .Select(
- (objectProperty) =>
- new KeyValuePair(
- this.jsonNavigator.GetStringValue(objectProperty.NameNode),
- CosmosElement.Dispatch(this.jsonNavigator, objectProperty.ValueNode)))
- .GetEnumerator();
+ public override IEnumerator> GetEnumerator()
+ {
+ return this
+.jsonNavigator
+.GetObjectProperties(this.jsonNavigatorNode)
+.Select(
+(objectProperty) =>
+new KeyValuePair(
+this.jsonNavigator.GetStringValue(objectProperty.NameNode),
+CosmosElement.Dispatch(this.jsonNavigator, objectProperty.ValueNode)))
+.GetEnumerator();
+ }
public override bool TryGetValue(string key, out CosmosElement value)
{
@@ -111,9 +116,15 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return false;
}
- public override void WriteTo(IJsonWriter jsonWriter) => this.jsonNavigator.WriteNode(this.jsonNavigatorNode, jsonWriter);
+ public override void WriteTo(IJsonWriter jsonWriter)
+ {
+ this.jsonNavigator.WriteNode(this.jsonNavigatorNode, jsonWriter);
+ }
- public override IJsonReader CreateReader() => this.jsonNavigator.CreateReader(this.jsonNavigatorNode);
+ public override IJsonReader CreateReader()
+ {
+ return this.jsonNavigator.CreateReader(this.jsonNavigatorNode);
+ }
}
}
#if INTERNAL
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.cs
index a63393e20..6bfa438e7 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosObject.cs
@@ -43,11 +43,20 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
public abstract bool TryGetValue(string key, out CosmosElement value);
- public override void Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override void Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ return cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input) => cosmosElementVisitor.Visit(this, input);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input)
+ {
+ return cosmosElementVisitor.Visit(this, input);
+ }
public bool TryGetValue(string key, out TCosmosElement typedCosmosElement)
where TCosmosElement : CosmosElement
@@ -74,9 +83,15 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
public abstract IEnumerator> GetEnumerator();
- IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator();
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return this.GetEnumerator();
+ }
- public override bool Equals(CosmosElement cosmosElement) => cosmosElement is CosmosObject cosmosObject && this.Equals(cosmosObject);
+ public override bool Equals(CosmosElement cosmosElement)
+ {
+ return cosmosElement is CosmosObject cosmosObject && this.Equals(cosmosObject);
+ }
public bool Equals(CosmosObject cosmosObject)
{
@@ -135,29 +150,56 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
public static CosmosObject Create(
IJsonNavigator jsonNavigator,
- IJsonNavigatorNode jsonNavigatorNode) => new LazyCosmosObject(jsonNavigator, jsonNavigatorNode);
+ IJsonNavigatorNode jsonNavigatorNode)
+ {
+ return new LazyCosmosObject(jsonNavigator, jsonNavigatorNode);
+ }
- public static CosmosObject Create(IReadOnlyDictionary dictionary) => new EagerCosmosObject(dictionary.ToList());
+ public static CosmosObject Create(IReadOnlyDictionary dictionary)
+ {
+ return new EagerCosmosObject(dictionary.ToList());
+ }
- public static CosmosObject Create(IReadOnlyList> properties) => new EagerCosmosObject(properties);
+ public static CosmosObject Create(IReadOnlyList> properties)
+ {
+ return new EagerCosmosObject(properties);
+ }
- public static new CosmosObject CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.CreateFromBuffer(buffer);
+ public static new CosmosObject CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.CreateFromBuffer(buffer);
+ }
- public static new CosmosObject Parse(string json) => CosmosElement.Parse(json);
+ public static new CosmosObject Parse(string json)
+ {
+ return CosmosElement.Parse(json);
+ }
public static bool TryCreateFromBuffer(
ReadOnlyMemory buffer,
- out CosmosObject cosmosObject) => CosmosElement.TryCreateFromBuffer(buffer, out cosmosObject);
+ out CosmosObject cosmosObject)
+ {
+ return CosmosElement.TryCreateFromBuffer(buffer, out cosmosObject);
+ }
public static bool TryParse(
string json,
- out CosmosObject cosmosObject) => CosmosElement.TryParse(json, out cosmosObject);
+ out CosmosObject cosmosObject)
+ {
+ return CosmosElement.TryParse(json, out cosmosObject);
+ }
public static new class Monadic
{
- public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.Monadic.CreateFromBuffer(buffer);
+ public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.Monadic.CreateFromBuffer(buffer);
+ }
- public static TryCatch Parse(string json) => CosmosElement.Monadic.Parse(json);
+ public static TryCatch Parse(string json)
+ {
+ return CosmosElement.Monadic.Parse(json);
+ }
}
}
#if INTERNAL
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.EagerCosmosString.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.EagerCosmosString.cs
index ae9417a2d..5ff0709dd 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.EagerCosmosString.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.EagerCosmosString.cs
@@ -33,7 +33,10 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return false;
}
- public override void WriteTo(IJsonWriter jsonWriter) => jsonWriter.WriteStringValue(this.Value);
+ public override void WriteTo(IJsonWriter jsonWriter)
+ {
+ jsonWriter.WriteStringValue(this.Value);
+ }
}
}
#if INTERNAL
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.LazyCosmosString.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.LazyCosmosString.cs
index deeeed9c4..e89a1800f 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.LazyCosmosString.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.LazyCosmosString.cs
@@ -38,11 +38,17 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
public override string Value => this.lazyString.Value;
- public override bool TryGetBufferedValue(out Utf8Memory bufferedValue) => this.jsonNavigator.TryGetBufferedStringValue(
- this.jsonNavigatorNode,
- out bufferedValue);
+ public override bool TryGetBufferedValue(out Utf8Memory bufferedValue)
+ {
+ return this.jsonNavigator.TryGetBufferedStringValue(
+this.jsonNavigatorNode,
+out bufferedValue);
+ }
- public override void WriteTo(IJsonWriter jsonWriter) => this.jsonNavigator.WriteNode(this.jsonNavigatorNode, jsonWriter);
+ public override void WriteTo(IJsonWriter jsonWriter)
+ {
+ this.jsonNavigator.WriteNode(this.jsonNavigatorNode, jsonWriter);
+ }
}
}
#if INTERNAL
diff --git a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.cs b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.cs
index ac2087a4e..fda413b17 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosElements/CosmosString.cs
@@ -32,15 +32,30 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
public abstract bool TryGetBufferedValue(out Utf8Memory bufferedUtf8Value);
- public override void Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override void Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor) => cosmosElementVisitor.Visit(this);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor)
+ {
+ return cosmosElementVisitor.Visit(this);
+ }
- public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input) => cosmosElementVisitor.Visit(this, input);
+ public override TResult Accept(ICosmosElementVisitor cosmosElementVisitor, TArg input)
+ {
+ return cosmosElementVisitor.Visit(this, input);
+ }
- public override bool Equals(CosmosElement cosmosElement) => cosmosElement is CosmosString cosmosString && this.Equals(cosmosString);
+ public override bool Equals(CosmosElement cosmosElement)
+ {
+ return cosmosElement is CosmosString cosmosString && this.Equals(cosmosString);
+ }
- public bool Equals(CosmosString cosmosString) => this.Value == cosmosString.Value;
+ public bool Equals(CosmosString cosmosString)
+ {
+ return this.Value == cosmosString.Value;
+ }
public override int GetHashCode()
{
@@ -50,31 +65,58 @@ namespace Microsoft.Azure.Cosmos.CosmosElements
return (int)hash;
}
- public int CompareTo(CosmosString cosmosString) => string.CompareOrdinal(this.Value, cosmosString.Value);
+ public int CompareTo(CosmosString cosmosString)
+ {
+ return string.CompareOrdinal(this.Value, cosmosString.Value);
+ }
public static CosmosString Create(
IJsonNavigator jsonNavigator,
- IJsonNavigatorNode jsonNavigatorNode) => new LazyCosmosString(jsonNavigator, jsonNavigatorNode);
+ IJsonNavigatorNode jsonNavigatorNode)
+ {
+ return new LazyCosmosString(jsonNavigator, jsonNavigatorNode);
+ }
- public static CosmosString Create(string value) => value.Length == 0 ? EagerCosmosString.Empty : new EagerCosmosString(value);
+ public static CosmosString Create(string value)
+ {
+ return value.Length == 0 ? EagerCosmosString.Empty : new EagerCosmosString(value);
+ }
- public static new CosmosString CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.CreateFromBuffer(buffer);
+ public static new CosmosString CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.CreateFromBuffer(buffer);
+ }
- public static new CosmosString Parse(string json) => CosmosElement.Parse(json);
+ public static new CosmosString Parse(string json)
+ {
+ return CosmosElement.Parse(json);
+ }
public static bool TryCreateFromBuffer(
ReadOnlyMemory buffer,
- out CosmosString cosmosString) => CosmosElement.TryCreateFromBuffer(buffer, out cosmosString);
+ out CosmosString cosmosString)
+ {
+ return CosmosElement.TryCreateFromBuffer(buffer, out cosmosString);
+ }
public static bool TryParse(
string json,
- out CosmosString cosmosString) => CosmosElement.TryParse(json, out cosmosString);
+ out CosmosString cosmosString)
+ {
+ return CosmosElement.TryParse(json, out cosmosString);
+ }
public static new class Monadic
{
- public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer) => CosmosElement.Monadic.CreateFromBuffer(buffer);
+ public static TryCatch CreateFromBuffer(ReadOnlyMemory buffer)
+ {
+ return CosmosElement.Monadic.CreateFromBuffer(buffer);
+ }
- public static TryCatch Parse(string json) => CosmosElement.Monadic.Parse(json);
+ public static TryCatch Parse(string json)
+ {
+ return CosmosElement.Monadic.Parse