Skip to content

Commit

Permalink
Update more places
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven.Darby authored and Steven.Darby committed Apr 12, 2024
1 parent 9944a0f commit 117a80f
Show file tree
Hide file tree
Showing 50 changed files with 370 additions and 370 deletions.
16 changes: 8 additions & 8 deletions src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static class CosmosEntityTypeExtensions
public static void SetContainer(this IMutableEntityType entityType, string? name)
=> entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.ContainerName,
Check.NullButNotEmpty(name, nameof(name)));
Check.NullButNotEmpty(name));

/// <summary>
/// Sets the name of the container to which the entity type is mapped.
Expand All @@ -54,7 +54,7 @@ public static void SetContainer(this IMutableEntityType entityType, string? name
bool fromDataAnnotation = false)
=> (string?)entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.ContainerName,
Check.NullButNotEmpty(name, nameof(name)),
Check.NullButNotEmpty(name),
fromDataAnnotation)?.Value;

/// <summary>
Expand Down Expand Up @@ -88,7 +88,7 @@ public static void SetContainer(this IMutableEntityType entityType, string? name
public static void SetContainingPropertyName(this IMutableEntityType entityType, string? name)
=> entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.PropertyName,
Check.NullButNotEmpty(name, nameof(name)));
Check.NullButNotEmpty(name));

/// <summary>
/// Sets the name of the parent property to which the entity type is mapped.
Expand All @@ -102,7 +102,7 @@ public static void SetContainingPropertyName(this IMutableEntityType entityType,
bool fromDataAnnotation = false)
=> (string?)entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.PropertyName,
Check.NullButNotEmpty(name, nameof(name)),
Check.NullButNotEmpty(name),
fromDataAnnotation)?.Value;

/// <summary>
Expand Down Expand Up @@ -130,7 +130,7 @@ public static void SetContainingPropertyName(this IMutableEntityType entityType,
public static void SetPartitionKeyPropertyName(this IMutableEntityType entityType, string? name)
=> entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.PartitionKeyName,
Check.NullButNotEmpty(name, nameof(name)));
Check.NullButNotEmpty(name));

/// <summary>
/// Sets the name of the property that is used to store the partition key.
Expand All @@ -144,7 +144,7 @@ public static void SetPartitionKeyPropertyName(this IMutableEntityType entityTyp
bool fromDataAnnotation = false)
=> (string?)entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.PartitionKeyName,
Check.NullButNotEmpty(name, nameof(name)),
Check.NullButNotEmpty(name),
fromDataAnnotation)?.Value;

/// <summary>
Expand Down Expand Up @@ -224,7 +224,7 @@ public static void SetPartitionKeyPropertyName(this IMutableEntityType entityTyp
public static void SetETagPropertyName(this IMutableEntityType entityType, string? name)
=> entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.ETagName,
Check.NullButNotEmpty(name, nameof(name)));
Check.NullButNotEmpty(name));

/// <summary>
/// Sets the name of the property that is used to store the ETag.
Expand All @@ -238,7 +238,7 @@ public static void SetETagPropertyName(this IMutableEntityType entityType, strin
bool fromDataAnnotation = false)
=> (string?)entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.ETagName,
Check.NullButNotEmpty(name, nameof(name)),
Check.NullButNotEmpty(name),
fromDataAnnotation)?.Value;

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore.Cosmos/Extensions/CosmosModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static class CosmosModelExtensions
public static void SetDefaultContainer(this IMutableModel model, string? name)
=> model.SetOrRemoveAnnotation(
CosmosAnnotationNames.ContainerName,
Check.NullButNotEmpty(name, nameof(name)));
Check.NullButNotEmpty(name));

/// <summary>
/// Sets the default container name.
Expand All @@ -46,7 +46,7 @@ public static void SetDefaultContainer(this IMutableModel model, string? name)
bool fromDataAnnotation = false)
=> (string?)model.SetOrRemoveAnnotation(
CosmosAnnotationNames.ContainerName,
Check.NullButNotEmpty(name, nameof(name)),
Check.NullButNotEmpty(name),
fromDataAnnotation)?.Value;

/// <summary>
Expand Down
28 changes: 14 additions & 14 deletions src/EFCore.Cosmos/Infrastructure/CosmosDbContextOptionsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ DbContextOptionsBuilder ICosmosDbContextOptionsBuilderInfrastructure.OptionsBuil
/// <param name="getExecutionStrategy">A function that returns a new instance of an execution strategy.</param>
public virtual CosmosDbContextOptionsBuilder ExecutionStrategy(
Func<ExecutionStrategyDependencies, IExecutionStrategy> getExecutionStrategy)
=> WithOption(e => e.WithExecutionStrategyFactory(Check.NotNull(getExecutionStrategy, nameof(getExecutionStrategy))));
=> WithOption(e => e.WithExecutionStrategyFactory(Check.NotNull(getExecutionStrategy)));

/// <summary>
/// Configures the context to use the provided geo-replicated region.
Expand All @@ -63,7 +63,7 @@ DbContextOptionsBuilder ICosmosDbContextOptionsBuilderInfrastructure.OptionsBuil
/// </remarks>
/// <param name="region">Azure Cosmos DB region name.</param>
public virtual CosmosDbContextOptionsBuilder Region(string region)
=> WithOption(e => e.WithRegion(Check.NotNull(region, nameof(region))));
=> WithOption(e => e.WithRegion(Check.NotNull(region)));

/// <summary>
/// Configures the context to use the provided preferred regions for geo-replicated database accounts.
Expand All @@ -74,7 +74,7 @@ public virtual CosmosDbContextOptionsBuilder Region(string region)
/// </remarks>
/// <param name="regions">A list of Azure Cosmos DB region names.</param>
public virtual CosmosDbContextOptionsBuilder PreferredRegions(IReadOnlyList<string> regions)
=> WithOption(e => e.WithPreferredRegions(Check.NotNull(regions, nameof(regions))));
=> WithOption(e => e.WithPreferredRegions(Check.NotNull(regions)));

/// <summary>
/// Limits the operations to the provided endpoint.
Expand All @@ -85,7 +85,7 @@ public virtual CosmosDbContextOptionsBuilder PreferredRegions(IReadOnlyList<stri
/// </remarks>
/// <param name="enable"><see langword="true" /> to limit the operations to the provided endpoint.</param>
public virtual CosmosDbContextOptionsBuilder LimitToEndpoint(bool enable = true)
=> WithOption(e => e.WithLimitToEndpoint(Check.NotNull(enable, nameof(enable))));
=> WithOption(e => e.WithLimitToEndpoint(Check.NotNull(enable)));

/// <summary>
/// Configures the context to use a specific <see cref="HttpClient" /> factory.
Expand All @@ -105,7 +105,7 @@ public virtual CosmosDbContextOptionsBuilder LimitToEndpoint(bool enable = true)
/// </remarks>
/// <param name="httpClientFactory">A function that returns an <see cref="HttpClient" />.</param>
public virtual CosmosDbContextOptionsBuilder HttpClientFactory(Func<HttpClient>? httpClientFactory)
=> WithOption(e => e.WithHttpClientFactory(Check.NotNull(httpClientFactory, nameof(httpClientFactory))));
=> WithOption(e => e.WithHttpClientFactory(Check.NotNull(httpClientFactory)));

/// <summary>
/// Configures the context to use the provided connection mode.
Expand All @@ -116,7 +116,7 @@ public virtual CosmosDbContextOptionsBuilder HttpClientFactory(Func<HttpClient>?
/// </remarks>
/// <param name="connectionMode">Azure Cosmos DB connection mode.</param>
public virtual CosmosDbContextOptionsBuilder ConnectionMode(ConnectionMode connectionMode)
=> WithOption(e => e.WithConnectionMode(Check.NotNull(connectionMode, nameof(connectionMode))));
=> WithOption(e => e.WithConnectionMode(Check.NotNull(connectionMode)));

/// <summary>
/// Configures the proxy information used for web requests.
Expand All @@ -127,7 +127,7 @@ public virtual CosmosDbContextOptionsBuilder ConnectionMode(ConnectionMode conne
/// </remarks>
/// <param name="proxy">The proxy information used for web requests.</param>
public virtual CosmosDbContextOptionsBuilder WebProxy(IWebProxy proxy)
=> WithOption(e => e.WithWebProxy(Check.NotNull(proxy, nameof(proxy))));
=> WithOption(e => e.WithWebProxy(Check.NotNull(proxy)));

/// <summary>
/// Configures the timeout when connecting to the Azure Cosmos DB service.
Expand All @@ -139,7 +139,7 @@ public virtual CosmosDbContextOptionsBuilder WebProxy(IWebProxy proxy)
/// </remarks>
/// <param name="timeout">Request timeout.</param>
public virtual CosmosDbContextOptionsBuilder RequestTimeout(TimeSpan timeout)
=> WithOption(e => e.WithRequestTimeout(Check.NotNull(timeout, nameof(timeout))));
=> WithOption(e => e.WithRequestTimeout(Check.NotNull(timeout)));

/// <summary>
/// Configures the amount of time allowed for trying to establish a connection.
Expand All @@ -150,7 +150,7 @@ public virtual CosmosDbContextOptionsBuilder RequestTimeout(TimeSpan timeout)
/// </remarks>
/// <param name="timeout">Open TCP connection timeout.</param>
public virtual CosmosDbContextOptionsBuilder OpenTcpConnectionTimeout(TimeSpan timeout)
=> WithOption(e => e.WithOpenTcpConnectionTimeout(Check.NotNull(timeout, nameof(timeout))));
=> WithOption(e => e.WithOpenTcpConnectionTimeout(Check.NotNull(timeout)));

/// <summary>
/// Configures the amount of idle time after which unused connections are closed.
Expand All @@ -161,7 +161,7 @@ public virtual CosmosDbContextOptionsBuilder OpenTcpConnectionTimeout(TimeSpan t
/// </remarks>
/// <param name="timeout">Idle connection timeout.</param>
public virtual CosmosDbContextOptionsBuilder IdleTcpConnectionTimeout(TimeSpan timeout)
=> WithOption(e => e.WithIdleTcpConnectionTimeout(Check.NotNull(timeout, nameof(timeout))));
=> WithOption(e => e.WithIdleTcpConnectionTimeout(Check.NotNull(timeout)));

/// <summary>
/// Configures the maximum number of concurrent connections allowed for the target service endpoint
Expand All @@ -173,7 +173,7 @@ public virtual CosmosDbContextOptionsBuilder IdleTcpConnectionTimeout(TimeSpan t
/// </remarks>
/// <param name="connectionLimit">The maximum number of concurrent connections allowed.</param>
public virtual CosmosDbContextOptionsBuilder GatewayModeMaxConnectionLimit(int connectionLimit)
=> WithOption(e => e.WithGatewayModeMaxConnectionLimit(Check.NotNull(connectionLimit, nameof(connectionLimit))));
=> WithOption(e => e.WithGatewayModeMaxConnectionLimit(Check.NotNull(connectionLimit)));

/// <summary>
/// Configures the maximum number of TCP connections that may be opened to each Cosmos DB back-end.
Expand All @@ -186,7 +186,7 @@ public virtual CosmosDbContextOptionsBuilder GatewayModeMaxConnectionLimit(int c
/// </remarks>
/// <param name="connectionLimit">The maximum number of TCP connections that may be opened to each Cosmos DB back-end.</param>
public virtual CosmosDbContextOptionsBuilder MaxTcpConnectionsPerEndpoint(int connectionLimit)
=> WithOption(e => e.WithMaxTcpConnectionsPerEndpoint(Check.NotNull(connectionLimit, nameof(connectionLimit))));
=> WithOption(e => e.WithMaxTcpConnectionsPerEndpoint(Check.NotNull(connectionLimit)));

/// <summary>
/// Configures the number of requests allowed simultaneously over a single TCP connection.
Expand All @@ -198,7 +198,7 @@ public virtual CosmosDbContextOptionsBuilder MaxTcpConnectionsPerEndpoint(int co
/// </remarks>
/// <param name="requestLimit">The number of requests allowed simultaneously over a single TCP connection.</param>
public virtual CosmosDbContextOptionsBuilder MaxRequestsPerTcpConnection(int requestLimit)
=> WithOption(e => e.WithMaxRequestsPerTcpConnection(Check.NotNull(requestLimit, nameof(requestLimit))));
=> WithOption(e => e.WithMaxRequestsPerTcpConnection(Check.NotNull(requestLimit)));

/// <summary>
/// Sets the boolean to only return the headers and status code in the Cosmos DB response for write item operation
Expand All @@ -211,7 +211,7 @@ public virtual CosmosDbContextOptionsBuilder MaxRequestsPerTcpConnection(int req
/// </remarks>
/// <param name="enabled"><see langword="false" /> to have null resource</param>
public virtual CosmosDbContextOptionsBuilder ContentResponseOnWriteEnabled(bool enabled = true)
=> WithOption(e => e.ContentResponseOnWriteEnabled(Check.NotNull(enabled, nameof(enabled))));
=> WithOption(e => e.ContentResponseOnWriteEnabled(Check.NotNull(enabled)));

/// <summary>
/// Sets an option by cloning the extension used to store the settings. This ensures the builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static string GetStoreType(this IElementType elementType)
public static void SetStoreType(this IMutableElementType elementType, string? value)
=> elementType.SetOrRemoveAnnotation(
RelationalAnnotationNames.StoreType,
Check.NullButNotEmpty(value, nameof(value)));
Check.NullButNotEmpty(value));

/// <summary>
/// Sets the database type of the elements.
Expand All @@ -53,7 +53,7 @@ public static void SetStoreType(this IMutableElementType elementType, string? va
bool fromDataAnnotation = false)
=> (string?)elementType.SetOrRemoveAnnotation(
RelationalAnnotationNames.StoreType,
Check.NullButNotEmpty(value, nameof(value)),
Check.NullButNotEmpty(value),
fromDataAnnotation)?.Value;

/// <summary>
Expand Down

0 comments on commit 117a80f

Please sign in to comment.