diff --git a/src/EFCore.Cosmos/Diagnostics/CosmosEventId.cs b/src/EFCore.Cosmos/Diagnostics/CosmosEventId.cs
index eae88cb19a1..6d95499634e 100644
--- a/src/EFCore.Cosmos/Diagnostics/CosmosEventId.cs
+++ b/src/EFCore.Cosmos/Diagnostics/CosmosEventId.cs
@@ -31,7 +31,9 @@ private enum Id
}
private static readonly string _queryPrefix = DbLoggerCategory.Query.Name + ".";
- private static EventId MakeQueryId(Id id) => new EventId((int)id, _queryPrefix + id);
+
+ private static EventId MakeQueryId(Id id)
+ => new EventId((int)id, _queryPrefix + id);
///
///
diff --git a/src/EFCore.Cosmos/Extensions/CosmosDbContextOptionsExtensions.cs b/src/EFCore.Cosmos/Extensions/CosmosDbContextOptionsExtensions.cs
index 84a1d12a676..64891348245 100644
--- a/src/EFCore.Cosmos/Extensions/CosmosDbContextOptionsExtensions.cs
+++ b/src/EFCore.Cosmos/Extensions/CosmosDbContextOptionsExtensions.cs
@@ -61,7 +61,7 @@ public static DbContextOptionsBuilder UseCosmos(
Check.NotEmpty(databaseName, nameof(databaseName));
var extension = optionsBuilder.Options.FindExtension()
- ?? new CosmosOptionsExtension();
+ ?? new CosmosOptionsExtension();
extension = extension
.WithAccountEndpoint(accountEndpoint)
@@ -115,7 +115,7 @@ public static DbContextOptionsBuilder UseCosmos(
Check.NotNull(databaseName, nameof(databaseName));
var extension = optionsBuilder.Options.FindExtension()
- ?? new CosmosOptionsExtension();
+ ?? new CosmosOptionsExtension();
extension = extension
.WithConnectionString(connectionString)
diff --git a/src/EFCore.Cosmos/Extensions/CosmosEntityTypeBuilderExtensions.cs b/src/EFCore.Cosmos/Extensions/CosmosEntityTypeBuilderExtensions.cs
index 6cfd2d21506..9f3c918835f 100644
--- a/src/EFCore.Cosmos/Extensions/CosmosEntityTypeBuilderExtensions.cs
+++ b/src/EFCore.Cosmos/Extensions/CosmosEntityTypeBuilderExtensions.cs
@@ -83,7 +83,9 @@ public static IConventionEntityTypeBuilder ToContainer(
/// Indicates whether the configuration was specified using a data annotation.
/// if the configuration can be applied.
public static bool CanSetContainer(
- [NotNull] this IConventionEntityTypeBuilder entityTypeBuilder, [CanBeNull] string name, bool fromDataAnnotation = false)
+ [NotNull] this IConventionEntityTypeBuilder entityTypeBuilder,
+ [CanBeNull] string name,
+ bool fromDataAnnotation = false)
{
Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder));
Check.NullButNotEmpty(name, nameof(name));
@@ -157,7 +159,9 @@ public static IConventionEntityTypeBuilder ToJsonProperty(
/// Indicates whether the configuration was specified using a data annotation.
/// if the configuration can be applied.
public static bool CanSetJsonProperty(
- [NotNull] this IConventionEntityTypeBuilder entityTypeBuilder, [CanBeNull] string name, bool fromDataAnnotation = false)
+ [NotNull] this IConventionEntityTypeBuilder entityTypeBuilder,
+ [CanBeNull] string name,
+ bool fromDataAnnotation = false)
{
Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder));
Check.NullButNotEmpty(name, nameof(name));
@@ -248,7 +252,9 @@ public static IConventionEntityTypeBuilder HasPartitionKey(
/// Indicates whether the configuration was specified using a data annotation.
/// if the configuration can be applied.
public static bool CanSetPartitionKey(
- [NotNull] this IConventionEntityTypeBuilder entityTypeBuilder, [CanBeNull] string name, bool fromDataAnnotation = false)
+ [NotNull] this IConventionEntityTypeBuilder entityTypeBuilder,
+ [CanBeNull] string name,
+ bool fromDataAnnotation = false)
{
Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder));
Check.NullButNotEmpty(name, nameof(name));
diff --git a/src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs b/src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs
index 48c3c9d1664..06df02876a3 100644
--- a/src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs
+++ b/src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs
@@ -19,17 +19,17 @@ public static class CosmosEntityTypeExtensions
///
/// The entity type to get the container name for.
/// The name of the container to which the entity type is mapped.
- public static string GetContainer([NotNull] this IEntityType entityType) =>
- entityType.BaseType != null
+ public static string GetContainer([NotNull] this IEntityType entityType)
+ => entityType.BaseType != null
? entityType.GetRootType().GetContainer()
: (string)entityType[CosmosAnnotationNames.ContainerName]
- ?? GetDefaultContainer(entityType);
+ ?? GetDefaultContainer(entityType);
private static string GetDefaultContainer(IEntityType entityType)
=> entityType.IsOwned()
? null
: entityType.Model.GetDefaultContainer()
- ?? entityType.ShortName();
+ ?? entityType.ShortName();
///
/// Sets the name of the container to which the entity type is mapped.
@@ -48,7 +48,9 @@ public static void SetContainer([NotNull] this IMutableEntityType entityType, [C
/// The name to set.
/// Indicates whether the configuration was specified using a data annotation.
public static void SetContainer(
- [NotNull] this IConventionEntityType entityType, [CanBeNull] string name, bool fromDataAnnotation = false)
+ [NotNull] this IConventionEntityType entityType,
+ [CanBeNull] string name,
+ bool fromDataAnnotation = false)
=> entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.ContainerName,
Check.NullButNotEmpty(name, nameof(name)),
@@ -68,9 +70,9 @@ public static void SetContainer(
///
/// The entity type to get the containing property name for.
/// The name of the parent property to which the entity type is mapped.
- public static string GetContainingPropertyName([NotNull] this IEntityType entityType) =>
- entityType[CosmosAnnotationNames.PropertyName] as string
- ?? GetDefaultContainingPropertyName(entityType);
+ public static string GetContainingPropertyName([NotNull] this IEntityType entityType)
+ => entityType[CosmosAnnotationNames.PropertyName] as string
+ ?? GetDefaultContainingPropertyName(entityType);
private static string GetDefaultContainingPropertyName(IEntityType entityType)
=> entityType.FindOwnership()?.PrincipalToDependent.Name;
@@ -92,7 +94,9 @@ public static void SetContainingPropertyName([NotNull] this IMutableEntityType e
/// The name to set.
/// Indicates whether the configuration was specified using a data annotation.
public static void SetContainingPropertyName(
- [NotNull] this IConventionEntityType entityType, [CanBeNull] string name, bool fromDataAnnotation = false)
+ [NotNull] this IConventionEntityType entityType,
+ [CanBeNull] string name,
+ bool fromDataAnnotation = false)
=> entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.PropertyName,
Check.NullButNotEmpty(name, nameof(name)),
@@ -132,7 +136,9 @@ public static void SetPartitionKeyPropertyName([NotNull] this IMutableEntityType
/// The name to set.
/// Indicates whether the configuration was specified using a data annotation.
public static void SetPartitionKeyPropertyName(
- [NotNull] this IConventionEntityType entityType, [CanBeNull] string name, bool fromDataAnnotation = false)
+ [NotNull] this IConventionEntityType entityType,
+ [CanBeNull] string name,
+ bool fromDataAnnotation = false)
=> entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.PartitionKeyName,
Check.NullButNotEmpty(name, nameof(name)),
@@ -172,7 +178,9 @@ public static void SetETagPropertyName([NotNull] this IMutableEntityType entityT
/// The name to set.
/// Indicates whether the configuration was specified using a data annotation.
public static void SetETagPropertyName(
- [NotNull] this IConventionEntityType entityType, [CanBeNull] string name, bool fromDataAnnotation = false)
+ [NotNull] this IConventionEntityType entityType,
+ [CanBeNull] string name,
+ bool fromDataAnnotation = false)
=> entityType.SetOrRemoveAnnotation(
CosmosAnnotationNames.ETagName,
Check.NullButNotEmpty(name, nameof(name)),
@@ -188,10 +196,10 @@ public static void SetETagPropertyName(
?.GetConfigurationSource();
///
- /// Gets the on this entity that is mapped to cosmos etag, if it exists.
+ /// Gets the on this entity that is mapped to cosmos etag, if it exists.
///
/// The entity type to get the etag property for.
- /// The mapped to etag, or null if no property is mapped to etag.
+ /// The mapped to etag, or null if no property is mapped to etag.
public static IProperty GetETagProperty([NotNull] this IEntityType entityType)
{
Check.NotNull(entityType, nameof(entityType));
diff --git a/src/EFCore.Cosmos/Extensions/CosmosModelExtensions.cs b/src/EFCore.Cosmos/Extensions/CosmosModelExtensions.cs
index 92172a5f4c6..c88a8e7ab89 100644
--- a/src/EFCore.Cosmos/Extensions/CosmosModelExtensions.cs
+++ b/src/EFCore.Cosmos/Extensions/CosmosModelExtensions.cs
@@ -40,7 +40,9 @@ public static void SetDefaultContainer([NotNull] this IMutableModel model, [CanB
/// Indicates whether the configuration was specified using a data annotation.
/// The configured value.
public static string SetDefaultContainer(
- [NotNull] this IConventionModel model, [CanBeNull] string name, bool fromDataAnnotation = false)
+ [NotNull] this IConventionModel model,
+ [CanBeNull] string name,
+ bool fromDataAnnotation = false)
{
model.SetOrRemoveAnnotation(
CosmosAnnotationNames.ContainerName,
diff --git a/src/EFCore.Cosmos/Extensions/CosmosPropertyExtensions.cs b/src/EFCore.Cosmos/Extensions/CosmosPropertyExtensions.cs
index d055fefd222..8db108e8e7b 100644
--- a/src/EFCore.Cosmos/Extensions/CosmosPropertyExtensions.cs
+++ b/src/EFCore.Cosmos/Extensions/CosmosPropertyExtensions.cs
@@ -19,9 +19,9 @@ public static class CosmosPropertyExtensions
///
/// The property.
/// Returns the property name that the property is mapped to when targeting Cosmos.
- public static string GetJsonPropertyName([NotNull] this IProperty property) =>
- (string)property[CosmosAnnotationNames.PropertyName]
- ?? GetDefaultJsonPropertyName(property);
+ public static string GetJsonPropertyName([NotNull] this IProperty property)
+ => (string)property[CosmosAnnotationNames.PropertyName]
+ ?? GetDefaultJsonPropertyName(property);
private static string GetDefaultJsonPropertyName(IProperty property)
{
@@ -62,7 +62,9 @@ public static void SetJsonPropertyName([NotNull] this IMutableProperty property,
/// Indicates whether the configuration was specified using a data annotation.
/// The configured value.
public static string SetJsonPropertyName(
- [NotNull] this IConventionProperty property, [CanBeNull] string name, bool fromDataAnnotation = false)
+ [NotNull] this IConventionProperty property,
+ [CanBeNull] string name,
+ bool fromDataAnnotation = false)
{
property.SetOrRemoveAnnotation(
CosmosAnnotationNames.PropertyName,
diff --git a/src/EFCore.Cosmos/Extensions/CosmosQueryableExtensions.cs b/src/EFCore.Cosmos/Extensions/CosmosQueryableExtensions.cs
index b8d70437e63..6390979b93a 100644
--- a/src/EFCore.Cosmos/Extensions/CosmosQueryableExtensions.cs
+++ b/src/EFCore.Cosmos/Extensions/CosmosQueryableExtensions.cs
@@ -24,7 +24,7 @@ internal static readonly MethodInfo WithPartitionKeyMethodInfo
///
/// Specify the partition key for partition used for the query. Required when using
- /// a resource token that provides permission based on a partition key for authentication,
+ /// a resource token that provides permission based on a partition key for authentication,
///
/// The type of entity being queried.
/// The source query.
diff --git a/src/EFCore.Cosmos/Infrastructure/CosmosDbContextOptionsBuilder.cs b/src/EFCore.Cosmos/Infrastructure/CosmosDbContextOptionsBuilder.cs
index d84e03d2f59..e1f69174a94 100644
--- a/src/EFCore.Cosmos/Infrastructure/CosmosDbContextOptionsBuilder.cs
+++ b/src/EFCore.Cosmos/Infrastructure/CosmosDbContextOptionsBuilder.cs
@@ -55,7 +55,7 @@ public virtual CosmosDbContextOptionsBuilder Region([NotNull] string region)
///
/// Limits the operations to the provided endpoint.
///
- /// to limit the operations to the provided endpoint.
+ /// to limit the operations to the provided endpoint.
public virtual CosmosDbContextOptionsBuilder LimitToEndpoint(bool enable = true)
=> WithOption(e => e.WithLimitToEndpoint(Check.NotNull(enable, nameof(enable))));
@@ -141,22 +141,25 @@ protected virtual CosmosDbContextOptionsBuilder WithOption([NotNull] Func
/// A string that represents the current object.
[EditorBrowsable(EditorBrowsableState.Never)]
- public override string ToString() => base.ToString();
+ public override string ToString()
+ => base.ToString();
///
/// Determines whether the specified object is equal to the current object.
///
/// The object to compare with the current object.
- /// if the specified object is equal to the current object; otherwise, .
+ /// if the specified object is equal to the current object; otherwise, .
[EditorBrowsable(EditorBrowsableState.Never)]
- public override bool Equals(object obj) => base.Equals(obj);
+ public override bool Equals(object obj)
+ => base.Equals(obj);
///
/// Serves as the default hash function.
///
/// A hash code for the current object.
[EditorBrowsable(EditorBrowsableState.Never)]
- public override int GetHashCode() => base.GetHashCode();
+ public override int GetHashCode()
+ => base.GetHashCode();
#endregion
}
diff --git a/src/EFCore.Cosmos/Infrastructure/Internal/CosmosDbOptionExtension.cs b/src/EFCore.Cosmos/Infrastructure/Internal/CosmosDbOptionExtension.cs
index e21ab8c5d2b..9f388f8782d 100644
--- a/src/EFCore.Cosmos/Infrastructure/Internal/CosmosDbOptionExtension.cs
+++ b/src/EFCore.Cosmos/Infrastructure/Internal/CosmosDbOptionExtension.cs
@@ -91,7 +91,8 @@ public virtual DbContextOptionsExtensionInfo Info
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual string AccountEndpoint => _accountEndpoint;
+ public virtual string AccountEndpoint
+ => _accountEndpoint;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -119,7 +120,8 @@ public virtual CosmosOptionsExtension WithAccountEndpoint([NotNull] string accou
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual string AccountKey => _accountKey;
+ public virtual string AccountKey
+ => _accountKey;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -147,7 +149,8 @@ public virtual CosmosOptionsExtension WithAccountKey([NotNull] string accountKey
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual string ConnectionString => _connectionString;
+ public virtual string ConnectionString
+ => _connectionString;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -175,7 +178,8 @@ public virtual CosmosOptionsExtension WithConnectionString([NotNull] string conn
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual string DatabaseName => _databaseName;
+ public virtual string DatabaseName
+ => _databaseName;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -198,7 +202,8 @@ public virtual CosmosOptionsExtension WithDatabaseName([NotNull] string database
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual string Region => _region;
+ public virtual string Region
+ => _region;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -221,7 +226,8 @@ public virtual CosmosOptionsExtension WithRegion([NotNull] string region)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual bool? LimitToEndpoint => _limitToEndpoint;
+ public virtual bool? LimitToEndpoint
+ => _limitToEndpoint;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -244,7 +250,8 @@ public virtual CosmosOptionsExtension WithLimitToEndpoint(bool enable)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual ConnectionMode? ConnectionMode => _connectionMode;
+ public virtual ConnectionMode? ConnectionMode
+ => _connectionMode;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -272,7 +279,8 @@ public virtual CosmosOptionsExtension WithConnectionMode(ConnectionMode connecti
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual IWebProxy WebProxy => _webProxy;
+ public virtual IWebProxy WebProxy
+ => _webProxy;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -295,7 +303,8 @@ public virtual CosmosOptionsExtension WithWebProxy([NotNull] IWebProxy proxy)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual TimeSpan? RequestTimeout => _requestTimeout;
+ public virtual TimeSpan? RequestTimeout
+ => _requestTimeout;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -318,7 +327,8 @@ public virtual CosmosOptionsExtension WithRequestTimeout(TimeSpan timeout)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual TimeSpan? OpenTcpConnectionTimeout => _openTcpConnectionTimeout;
+ public virtual TimeSpan? OpenTcpConnectionTimeout
+ => _openTcpConnectionTimeout;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -341,7 +351,8 @@ public virtual CosmosOptionsExtension WithOpenTcpConnectionTimeout(TimeSpan time
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual TimeSpan? IdleTcpConnectionTimeout => _idleTcpConnectionTimeout;
+ public virtual TimeSpan? IdleTcpConnectionTimeout
+ => _idleTcpConnectionTimeout;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -364,7 +375,8 @@ public virtual CosmosOptionsExtension WithIdleTcpConnectionTimeout(TimeSpan time
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual int? GatewayModeMaxConnectionLimit => _gatewayModeMaxConnectionLimit;
+ public virtual int? GatewayModeMaxConnectionLimit
+ => _gatewayModeMaxConnectionLimit;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -387,7 +399,8 @@ public virtual CosmosOptionsExtension WithGatewayModeMaxConnectionLimit(int conn
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual int? MaxTcpConnectionsPerEndpoint => _maxTcpConnectionsPerEndpoint;
+ public virtual int? MaxTcpConnectionsPerEndpoint
+ => _maxTcpConnectionsPerEndpoint;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -410,7 +423,8 @@ public virtual CosmosOptionsExtension WithMaxTcpConnectionsPerEndpoint(int conne
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual int? MaxRequestsPerTcpConnection => _maxRequestsPerTcpConnection;
+ public virtual int? MaxRequestsPerTcpConnection
+ => _maxRequestsPerTcpConnection;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -431,7 +445,8 @@ public virtual CosmosOptionsExtension WithMaxRequestsPerTcpConnection(int reques
/// A factory for creating the default , or if none has been
/// configured.
///
- public virtual Func ExecutionStrategyFactory => _executionStrategyFactory;
+ public virtual Func ExecutionStrategyFactory
+ => _executionStrategyFactory;
///
/// Creates a new instance with all options the same as for this instance, but with the given option changed.
@@ -455,7 +470,8 @@ public virtual CosmosOptionsExtension WithExecutionStrategyFactory(
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- protected virtual CosmosOptionsExtension Clone() => new CosmosOptionsExtension(this);
+ protected virtual CosmosOptionsExtension Clone()
+ => new CosmosOptionsExtension(this);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -489,7 +505,8 @@ public ExtensionInfo(IDbContextOptionsExtension extension)
private new CosmosOptionsExtension Extension
=> (CosmosOptionsExtension)base.Extension;
- public override bool IsDatabaseProvider => true;
+ public override bool IsDatabaseProvider
+ => true;
public override long GetServiceProviderHashCode()
{
@@ -528,12 +545,13 @@ public override void PopulateDebugInfo(IDictionary debugInfo)
if (!string.IsNullOrEmpty(Extension._connectionString))
{
- debugInfo["Cosmos:" + nameof(ConnectionString)] = Extension._connectionString.GetHashCode().ToString(CultureInfo.InvariantCulture);
+ debugInfo["Cosmos:" + nameof(ConnectionString)] =
+ Extension._connectionString.GetHashCode().ToString(CultureInfo.InvariantCulture);
}
else
{
debugInfo["Cosmos:" + nameof(AccountEndpoint)] =
- Extension._accountEndpoint.GetHashCode().ToString(CultureInfo.InvariantCulture);
+ Extension._accountEndpoint.GetHashCode().ToString(CultureInfo.InvariantCulture);
debugInfo["Cosmos:" + nameof(AccountKey)] = Extension._accountKey.GetHashCode().ToString(CultureInfo.InvariantCulture);
}
diff --git a/src/EFCore.Cosmos/Infrastructure/Internal/CosmosSingletonOptions.cs b/src/EFCore.Cosmos/Infrastructure/Internal/CosmosSingletonOptions.cs
index 39282b5b194..375e3b07b81 100644
--- a/src/EFCore.Cosmos/Infrastructure/Internal/CosmosSingletonOptions.cs
+++ b/src/EFCore.Cosmos/Infrastructure/Internal/CosmosSingletonOptions.cs
@@ -4,7 +4,6 @@
using System;
using System.Net;
using Azure.Cosmos;
-using Microsoft.Azure.Cosmos;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
diff --git a/src/EFCore.Cosmos/Infrastructure/Internal/ICosmosSingletonOptions.cs b/src/EFCore.Cosmos/Infrastructure/Internal/ICosmosSingletonOptions.cs
index 547c52aea77..ff1b1ad4a06 100644
--- a/src/EFCore.Cosmos/Infrastructure/Internal/ICosmosSingletonOptions.cs
+++ b/src/EFCore.Cosmos/Infrastructure/Internal/ICosmosSingletonOptions.cs
@@ -95,7 +95,7 @@ public interface ICosmosSingletonOptions : ISingletonOptions
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- TimeSpan? OpenTcpConnectionTimeout { get; }
+ TimeSpan? OpenTcpConnectionTimeout { get; }
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.Cosmos/Internal/CosmosModelValidator.cs b/src/EFCore.Cosmos/Internal/CosmosModelValidator.cs
index b19f2a5ddbe..03fd6d0fc38 100644
--- a/src/EFCore.Cosmos/Internal/CosmosModelValidator.cs
+++ b/src/EFCore.Cosmos/Internal/CosmosModelValidator.cs
@@ -220,7 +220,8 @@ protected virtual void ValidateKeys(
continue;
}
- var idProperty = entityType.GetProperties().FirstOrDefault(p => p.GetJsonPropertyName() == StoreKeyConvention.IdPropertyJsonName);
+ var idProperty = entityType.GetProperties()
+ .FirstOrDefault(p => p.GetJsonPropertyName() == StoreKeyConvention.IdPropertyJsonName);
if (idProperty == null)
{
throw new InvalidOperationException(CosmosStrings.NoIdProperty(entityType.DisplayName()));
@@ -261,8 +262,9 @@ protected virtual void ValidateKeys(
if (!partitionKey.GetContainingKeys().Any(k => k.Properties.Contains(idProperty)))
{
- throw new InvalidOperationException(CosmosStrings.NoPartitionKeyKey(
- entityType.DisplayName(), partitionKeyPropertyName, idProperty.Name));
+ throw new InvalidOperationException(
+ CosmosStrings.NoPartitionKeyKey(
+ entityType.DisplayName(), partitionKeyPropertyName, idProperty.Name));
}
}
}
@@ -294,10 +296,8 @@ protected virtual void ValidateDatabaseProperties(
throw new InvalidOperationException(
CosmosStrings.JsonPropertyCollision(property.Name, otherProperty.Name, entityType.DisplayName(), jsonName));
}
- else
- {
- properties[jsonName] = property;
- }
+
+ properties[jsonName] = property;
}
foreach (var navigation in entityType.GetNavigations())
@@ -313,10 +313,8 @@ protected virtual void ValidateDatabaseProperties(
throw new InvalidOperationException(
CosmosStrings.JsonPropertyCollision(navigation.Name, otherProperty.Name, entityType.DisplayName(), jsonName));
}
- else
- {
- properties[jsonName] = navigation;
- }
+
+ properties[jsonName] = navigation;
}
}
}
diff --git a/src/EFCore.Cosmos/Metadata/Conventions/StoreKeyConvention.cs b/src/EFCore.Cosmos/Metadata/Conventions/StoreKeyConvention.cs
index 1f7204646d6..7cd6dbcedbd 100644
--- a/src/EFCore.Cosmos/Metadata/Conventions/StoreKeyConvention.cs
+++ b/src/EFCore.Cosmos/Metadata/Conventions/StoreKeyConvention.cs
@@ -9,7 +9,6 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure;
-using Microsoft.EntityFrameworkCore.Utilities;
using Newtonsoft.Json.Linq;
// ReSharper disable once CheckNamespace
@@ -117,6 +116,7 @@ private static void ProcessIdProperty(IConventionEntityTypeBuilder entityTypeBui
{
newKey = entityTypeBuilder.HasKey(new[] { idProperty, partitionKeyProperty })?.Metadata;
}
+
entityTypeBuilder.HasNoKey(new[] { idProperty });
}
}
diff --git a/src/EFCore.Cosmos/Metadata/Internal/CosmosEntityTypeExtensions.cs b/src/EFCore.Cosmos/Metadata/Internal/CosmosEntityTypeExtensions.cs
index 0648779f8c1..348c0f3bddf 100644
--- a/src/EFCore.Cosmos/Metadata/Internal/CosmosEntityTypeExtensions.cs
+++ b/src/EFCore.Cosmos/Metadata/Internal/CosmosEntityTypeExtensions.cs
@@ -22,7 +22,7 @@ public static class CosmosEntityTypeExtensions
///
public static bool IsDocumentRoot([NotNull] this IEntityType entityType)
=> entityType.BaseType?.IsDocumentRoot()
- ?? (!entityType.IsOwned()
- || entityType[CosmosAnnotationNames.ContainerName] != null);
+ ?? (!entityType.IsOwned()
+ || entityType[CosmosAnnotationNames.ContainerName] != null);
}
}
diff --git a/src/EFCore.Cosmos/Metadata/Internal/CosmosNavigationExtensions.cs b/src/EFCore.Cosmos/Metadata/Internal/CosmosNavigationExtensions.cs
index 90e85837f1f..6448b9a1c0d 100644
--- a/src/EFCore.Cosmos/Metadata/Internal/CosmosNavigationExtensions.cs
+++ b/src/EFCore.Cosmos/Metadata/Internal/CosmosNavigationExtensions.cs
@@ -22,6 +22,6 @@ public static class CosmosNavigationExtensions
///
public static bool IsEmbedded([NotNull] this INavigation navigation)
=> !navigation.IsOnDependent
- && !navigation.ForeignKey.DeclaringEntityType.IsDocumentRoot();
+ && !navigation.ForeignKey.DeclaringEntityType.IsDocumentRoot();
}
}
diff --git a/src/EFCore.Cosmos/Metadata/Internal/CosmosPropertyExtensions.cs b/src/EFCore.Cosmos/Metadata/Internal/CosmosPropertyExtensions.cs
index d7f2cf82af2..3462afb7b6c 100644
--- a/src/EFCore.Cosmos/Metadata/Internal/CosmosPropertyExtensions.cs
+++ b/src/EFCore.Cosmos/Metadata/Internal/CosmosPropertyExtensions.cs
@@ -23,7 +23,8 @@ public static class CosmosPropertyExtensions
///
public static bool IsOrdinalKeyProperty([NotNull] this IProperty property)
{
- Check.DebugAssert(property.DeclaringEntityType.IsOwned(), $"Expected {property.DeclaringEntityType.DisplayName()} to be owned.");
+ Check.DebugAssert(
+ property.DeclaringEntityType.IsOwned(), $"Expected {property.DeclaringEntityType.DisplayName()} to be owned.");
Check.DebugAssert(property.GetJsonPropertyName().Length == 0, $"Expected {property.Name} to be non-persisted.");
return property.IsPrimaryKey()
diff --git a/src/EFCore.Cosmos/Query/Internal/ContainsTranslator.cs b/src/EFCore.Cosmos/Query/Internal/ContainsTranslator.cs
index ee5eff7e9d7..922916b4fc9 100644
--- a/src/EFCore.Cosmos/Query/Internal/ContainsTranslator.cs
+++ b/src/EFCore.Cosmos/Query/Internal/ContainsTranslator.cs
@@ -35,7 +35,10 @@ public ContainsTranslator([NotNull] ISqlExpressionFactory sqlExpressionFactory)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual SqlExpression Translate(SqlExpression instance, MethodInfo method, IReadOnlyList arguments,
+ public virtual SqlExpression Translate(
+ SqlExpression instance,
+ MethodInfo method,
+ IReadOnlyList arguments,
IDiagnosticsLogger logger)
{
if (method.IsGenericMethod
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosMemberTranslatorProvider.cs b/src/EFCore.Cosmos/Query/Internal/CosmosMemberTranslatorProvider.cs
index 73aba51a107..2712a7470e3 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosMemberTranslatorProvider.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosMemberTranslatorProvider.cs
@@ -48,7 +48,10 @@ public CosmosMemberTranslatorProvider(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual SqlExpression Translate(
- SqlExpression instance, MemberInfo member, Type returnType, IDiagnosticsLogger logger)
+ SqlExpression instance,
+ MemberInfo member,
+ Type returnType,
+ IDiagnosticsLogger logger)
{
Check.NotNull(instance, nameof(instance));
Check.NotNull(member, nameof(member));
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosMethodCallTranslatorProvider.cs b/src/EFCore.Cosmos/Query/Internal/CosmosMethodCallTranslatorProvider.cs
index 2b386a5e0d1..94f1b066f23 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosMethodCallTranslatorProvider.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosMethodCallTranslatorProvider.cs
@@ -54,7 +54,10 @@ public CosmosMethodCallTranslatorProvider(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual SqlExpression Translate(
- IModel model, SqlExpression instance, MethodInfo method, IReadOnlyList arguments,
+ IModel model,
+ SqlExpression instance,
+ MethodInfo method,
+ IReadOnlyList arguments,
IDiagnosticsLogger logger)
{
Check.NotNull(model, nameof(model));
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs
index 2bfbcce59d7..2c9854a2182 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs
@@ -53,7 +53,8 @@ private readonly Stack _includedNavigations
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public CosmosProjectionBindingExpressionVisitor(
- [NotNull] IModel model, [NotNull] CosmosSqlTranslatingExpressionVisitor sqlTranslator)
+ [NotNull] IModel model,
+ [NotNull] CosmosSqlTranslatingExpressionVisitor sqlTranslator)
{
_model = model;
_sqlTranslator = sqlTranslator;
@@ -133,7 +134,8 @@ public override Expression Visit(Expression expression)
return parameterExpression;
}
- if (parameterExpression.Name?.StartsWith(QueryCompilationContext.QueryParameterPrefix, StringComparison.Ordinal) == true)
+ if (parameterExpression.Name?.StartsWith(QueryCompilationContext.QueryParameterPrefix, StringComparison.Ordinal)
+ == true)
{
return Expression.Call(
_getParameterValueMethodInfo.MakeGenericMethod(parameterExpression.Type),
@@ -241,8 +243,8 @@ protected override Expression VisitExtension(Expression extensionExpression)
case MaterializeCollectionNavigationExpression materializeCollectionNavigationExpression:
return materializeCollectionNavigationExpression.Navigation is INavigation embeddableNavigation
&& embeddableNavigation.IsEmbedded()
- ? base.Visit(materializeCollectionNavigationExpression.Subquery)
- : base.VisitExtension(materializeCollectionNavigationExpression);
+ ? base.Visit(materializeCollectionNavigationExpression.Subquery)
+ : base.VisitExtension(materializeCollectionNavigationExpression);
case IncludeExpression includeExpression:
if (!_clientEval)
@@ -708,10 +710,10 @@ protected override Expression VisitUnary(UnaryExpression unaryExpression)
var operand = Visit(unaryExpression.Operand);
return (unaryExpression.NodeType == ExpressionType.Convert
- || unaryExpression.NodeType == ExpressionType.ConvertChecked)
+ || unaryExpression.NodeType == ExpressionType.ConvertChecked)
&& unaryExpression.Type == operand.Type
- ? operand
- : unaryExpression.Update(MatchTypes(operand, unaryExpression.Operand.Type));
+ ? operand
+ : unaryExpression.Update(MatchTypes(operand, unaryExpression.Operand.Type));
}
// TODO: Debugging
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosQueryCompilationContext.cs b/src/EFCore.Cosmos/Query/Internal/CosmosQueryCompilationContext.cs
index 3f2bc134e5b..d29dd4e46a3 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosQueryCompilationContext.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosQueryCompilationContext.cs
@@ -21,7 +21,8 @@ public class CosmosQueryCompilationContext : QueryCompilationContext
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public CosmosQueryCompilationContext(
- [NotNull] QueryCompilationContextDependencies dependencies, bool async)
+ [NotNull] QueryCompilationContextDependencies dependencies,
+ bool async)
: base(dependencies, async)
{
}
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosQueryMetadataExtractingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosQueryMetadataExtractingExpressionVisitor.cs
index 0318c4ef57b..27591238144 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosQueryMetadataExtractingExpressionVisitor.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosQueryMetadataExtractingExpressionVisitor.cs
@@ -42,7 +42,8 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
{
var innerQueryable = Visit(methodCallExpression.Arguments[0]);
- _cosmosQueryCompilationContext.PartitionKeyFromExtension = (string)((ConstantExpression)methodCallExpression.Arguments[1]).Value;
+ _cosmosQueryCompilationContext.PartitionKeyFromExtension =
+ (string)((ConstantExpression)methodCallExpression.Arguments[1]).Value;
return innerQueryable;
}
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosQueryTranslationPreprocessorFactory.cs b/src/EFCore.Cosmos/Query/Internal/CosmosQueryTranslationPreprocessorFactory.cs
index b147f824343..b38ccbf7047 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosQueryTranslationPreprocessorFactory.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosQueryTranslationPreprocessorFactory.cs
@@ -45,6 +45,6 @@ public CosmosQueryTranslationPreprocessorFactory(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual QueryTranslationPreprocessor Create(QueryCompilationContext queryCompilationContext)
- => new CosmosQueryTranslationPreprocessor(_dependencies, (CosmosQueryCompilationContext)queryCompilationContext);
+ => new CosmosQueryTranslationPreprocessor(_dependencies, (CosmosQueryCompilationContext)queryCompilationContext);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosQueryableMethodTranslatingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosQueryableMethodTranslatingExpressionVisitor.cs
index 91cdbf66b9d..206f25ce8f6 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosQueryableMethodTranslatingExpressionVisitor.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosQueryableMethodTranslatingExpressionVisitor.cs
@@ -56,7 +56,8 @@ public CosmosQueryableMethodTranslatingExpressionVisitor(
_sqlExpressionFactory,
_memberTranslatorProvider,
_methodCallTranslatorProvider);
- _projectionBindingExpressionVisitor = new CosmosProjectionBindingExpressionVisitor(_queryCompilationContext.Model, _sqlTranslator);
+ _projectionBindingExpressionVisitor =
+ new CosmosProjectionBindingExpressionVisitor(_queryCompilationContext.Model, _sqlTranslator);
}
///
@@ -76,7 +77,8 @@ protected CosmosQueryableMethodTranslatingExpressionVisitor(
_sqlExpressionFactory,
_memberTranslatorProvider,
_methodCallTranslatorProvider);
- _projectionBindingExpressionVisitor = new CosmosProjectionBindingExpressionVisitor(_queryCompilationContext.Model, _sqlTranslator);
+ _projectionBindingExpressionVisitor =
+ new CosmosProjectionBindingExpressionVisitor(_queryCompilationContext.Model, _sqlTranslator);
}
///
@@ -118,8 +120,9 @@ public override Expression Visit(Expression expression)
&& (idProperty.GetValueGeneratorFactory() != null
|| entityTypePrimaryKeyProperties.Contains(idProperty)))
{
- var propertyParameterList = queryProperties.Zip(parameterNames,
- (property, parameter) => (property, parameter))
+ var propertyParameterList = queryProperties.Zip(
+ parameterNames,
+ (property, parameter) => (property, parameter))
.ToDictionary(tuple => tuple.property, tuple => tuple.parameter);
var readItemExpression = new ReadItemExpression(entityType, propertyParameterList);
@@ -135,8 +138,11 @@ public override Expression Visit(Expression expression)
return base.Visit(expression);
- static bool ExtractPartitionKeyFromPredicate(IEntityType entityType, Expression joinCondition,
- ICollection properties, ICollection parameterNames)
+ static bool ExtractPartitionKeyFromPredicate(
+ IEntityType entityType,
+ Expression joinCondition,
+ ICollection properties,
+ ICollection parameterNames)
{
if (joinCondition is BinaryExpression joinBinaryExpression)
{
@@ -156,6 +162,7 @@ static bool ExtractPartitionKeyFromPredicate(IEntityType entityType, Expression
{
return false;
}
+
properties.Add(property);
parameterNames.Add(equalParameterExpresion.Name);
return true;
@@ -427,7 +434,9 @@ protected override ShapedQueryExpression TranslateDistinct(ShapedQueryExpression
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateElementAtOrDefault(
- ShapedQueryExpression source, Expression index, bool returnDefault)
+ ShapedQueryExpression source,
+ Expression index,
+ bool returnDefault)
{
Check.NotNull(source, nameof(source));
Check.NotNull(index, nameof(index));
@@ -456,7 +465,10 @@ protected override ShapedQueryExpression TranslateExcept(ShapedQueryExpression s
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateFirstOrDefault(
- ShapedQueryExpression source, LambdaExpression predicate, Type returnType, bool returnDefault)
+ ShapedQueryExpression source,
+ LambdaExpression predicate,
+ Type returnType,
+ bool returnDefault)
{
Check.NotNull(source, nameof(source));
Check.NotNull(returnType, nameof(returnType));
@@ -565,7 +577,10 @@ protected override ShapedQueryExpression TranslateJoin(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateLastOrDefault(
- ShapedQueryExpression source, LambdaExpression predicate, Type returnType, bool returnDefault)
+ ShapedQueryExpression source,
+ LambdaExpression predicate,
+ Type returnType,
+ bool returnDefault)
{
Check.NotNull(source, nameof(source));
Check.NotNull(returnType, nameof(returnType));
@@ -775,7 +790,9 @@ protected override ShapedQueryExpression TranslateOfType(ShapedQueryExpression s
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateOrderBy(
- ShapedQueryExpression source, LambdaExpression keySelector, bool ascending)
+ ShapedQueryExpression source,
+ LambdaExpression keySelector,
+ bool ascending)
{
Check.NotNull(source, nameof(source));
Check.NotNull(keySelector, nameof(keySelector));
@@ -847,7 +864,9 @@ protected override ShapedQueryExpression TranslateSelect(ShapedQueryExpression s
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateSelectMany(
- ShapedQueryExpression source, LambdaExpression collectionSelector, LambdaExpression resultSelector)
+ ShapedQueryExpression source,
+ LambdaExpression collectionSelector,
+ LambdaExpression resultSelector)
{
Check.NotNull(source, nameof(source));
Check.NotNull(collectionSelector, nameof(collectionSelector));
@@ -877,7 +896,10 @@ protected override ShapedQueryExpression TranslateSelectMany(ShapedQueryExpressi
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateSingleOrDefault(
- ShapedQueryExpression source, LambdaExpression predicate, Type returnType, bool returnDefault)
+ ShapedQueryExpression source,
+ LambdaExpression predicate,
+ Type returnType,
+ bool returnDefault)
{
Check.NotNull(source, nameof(source));
Check.NotNull(returnType, nameof(returnType));
@@ -1067,7 +1089,8 @@ protected override ShapedQueryExpression TranslateWhere(ShapedQueryExpression so
if (source.ShaperExpression is EntityShaperExpression entityShaperExpression
&& entityShaperExpression.EntityType.GetPartitionKeyPropertyName() != null
- && TryExtractPartitionKey(predicate.Body, entityShaperExpression.EntityType, out var newPredicate) is Expression partitionKeyValue)
+ && TryExtractPartitionKey(predicate.Body, entityShaperExpression.EntityType, out var newPredicate) is Expression
+ partitionKeyValue)
{
var partitionKeyProperty = entityShaperExpression.EntityType.GetProperty(
entityShaperExpression.EntityType.GetPartitionKeyPropertyName());
@@ -1155,12 +1178,12 @@ bool IsPartitionKeyPropertyAccess(Expression expression, IEntityType entityType)
break;
case MethodCallExpression methodCallExpression
- when methodCallExpression.TryGetEFPropertyArguments(out _, out var propertyName):
+ when methodCallExpression.TryGetEFPropertyArguments(out _, out var propertyName):
property = entityType.FindProperty(propertyName);
break;
case MethodCallExpression methodCallExpression
- when methodCallExpression.TryGetIndexerArguments(_queryCompilationContext.Model, out _, out var propertyName):
+ when methodCallExpression.TryGetIndexerArguments(_queryCompilationContext.Model, out _, out var propertyName):
property = entityType.FindProperty(propertyName);
break;
}
@@ -1181,7 +1204,8 @@ private SqlExpression TranslateExpression(Expression expression)
}
private SqlExpression TranslateLambdaExpression(
- ShapedQueryExpression shapedQueryExpression, LambdaExpression lambdaExpression)
+ ShapedQueryExpression shapedQueryExpression,
+ LambdaExpression lambdaExpression)
{
var lambdaBody = RemapLambdaBody(shapedQueryExpression.ShaperExpression, lambdaExpression);
@@ -1194,7 +1218,10 @@ private static Expression RemapLambdaBody(Expression shaperBody, LambdaExpressio
}
private ShapedQueryExpression AggregateResultShaper(
- ShapedQueryExpression source, Expression projection, bool throwOnNullResult, Type resultType)
+ ShapedQueryExpression source,
+ Expression projection,
+ bool throwOnNullResult,
+ Type resultType)
{
var selectExpression = (SelectExpression)source.QueryExpression;
selectExpression.ReplaceProjectionMapping(
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitor.cs
index 147b0ee190e..9efbef8fc21 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitor.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitor.cs
@@ -19,7 +19,8 @@ private sealed class CosmosProjectionBindingRemovingExpressionVisitor : CosmosPr
public CosmosProjectionBindingRemovingExpressionVisitor(
[NotNull] SelectExpression selectExpression,
[NotNull] ParameterExpression jObjectParameter,
- bool trackQueryResults) : base(jObjectParameter, trackQueryResults)
+ bool trackQueryResults)
+ : base(jObjectParameter, trackQueryResults)
{
_selectExpression = selectExpression;
}
@@ -31,7 +32,7 @@ private int GetProjectionIndex(ProjectionBindingExpression projectionBindingExpr
=> projectionBindingExpression.ProjectionMember != null
? (int)((ConstantExpression)_selectExpression.GetMappedProjection(projectionBindingExpression.ProjectionMember)).Value
: projectionBindingExpression.Index
- ?? throw new InvalidOperationException(CoreStrings.QueryFailed(projectionBindingExpression.Print(), GetType().Name));
+ ?? throw new InvalidOperationException(CoreStrings.QueryFailed(projectionBindingExpression.Print(), GetType().Name));
}
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitorBase.cs b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitorBase.cs
index f430be2d4c0..79d70940519 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitorBase.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitorBase.cs
@@ -98,7 +98,7 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression)
storeName = projection.Alias;
}
else if (projectionExpression is UnaryExpression convertExpression
- && convertExpression.NodeType == ExpressionType.Convert)
+ && convertExpression.NodeType == ExpressionType.Convert)
{
// Unwrap EntityProjectionExpression when the root entity is not projected
projectionExpression = ((UnaryExpression)convertExpression.Operand).Operand;
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.InExpressionValuesExpandingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.InExpressionValuesExpandingExpressionVisitor.cs
index e83674a6625..2c343cc0db3 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.InExpressionValuesExpandingExpressionVisitor.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.InExpressionValuesExpandingExpressionVisitor.cs
@@ -16,7 +16,8 @@ private sealed class InExpressionValuesExpandingExpressionVisitor : ExpressionVi
private readonly IReadOnlyDictionary _parametersValues;
public InExpressionValuesExpandingExpressionVisitor(
- ISqlExpressionFactory sqlExpressionFactory, IReadOnlyDictionary parametersValues)
+ ISqlExpressionFactory sqlExpressionFactory,
+ IReadOnlyDictionary parametersValues)
{
_sqlExpressionFactory = sqlExpressionFactory;
_parametersValues = parametersValues;
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
index fe00deabf3f..05157db529e 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
@@ -67,8 +67,11 @@ public QueryingEnumerable(
public IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default)
=> new AsyncEnumerator(this, cancellationToken);
- public IEnumerator GetEnumerator() => new Enumerator(this);
- IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
+ public IEnumerator GetEnumerator()
+ => new Enumerator(this);
+
+ IEnumerator IEnumerable.GetEnumerator()
+ => GetEnumerator();
private CosmosSqlQuery GenerateQuery()
=> _querySqlGeneratorFactory.Create().GetSqlQuery(
@@ -127,7 +130,8 @@ public Enumerator(QueryingEnumerable queryingEnumerable)
public T Current { get; private set; }
- object IEnumerator.Current => Current;
+ object IEnumerator.Current
+ => Current;
public bool MoveNext()
{
@@ -143,7 +147,7 @@ public bool MoveNext()
_enumerator = _cosmosQueryContext.CosmosClient
.ExecuteSqlQuery(
- _selectExpression.Container,
+ _selectExpression.Container,
_partitionKey,
sqlQuery)
.GetEnumerator();
@@ -174,7 +178,8 @@ public void Dispose()
_enumerator = null;
}
- public void Reset() => throw new NotImplementedException();
+ public void Reset()
+ => throw new NotImplementedException();
}
private sealed class AsyncEnumerator : IAsyncEnumerator
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.ReadItemQueryingEnumerable.cs b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.ReadItemQueryingEnumerable.cs
index eb9864d64e2..ad66807e9a7 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.ReadItemQueryingEnumerable.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.ReadItemQueryingEnumerable.cs
@@ -54,9 +54,11 @@ public ReadItemQueryingEnumerable(
public IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default)
=> new Enumerator(this, cancellationToken);
- public IEnumerator GetEnumerator() => new Enumerator(this);
+ public IEnumerator GetEnumerator()
+ => new Enumerator(this);
- IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
+ IEnumerator IEnumerable.GetEnumerator()
+ => GetEnumerator();
public string ToQueryString()
{
@@ -163,7 +165,6 @@ private bool TryGenerateIdFromKeys(IProperty idProperty, out object value)
return value != null;
}
-
private sealed class Enumerator : IEnumerator, IAsyncEnumerator
{
private readonly CosmosQueryContext _cosmosQueryContext;
@@ -190,7 +191,8 @@ public Enumerator(ReadItemQueryingEnumerable readItemEnumerable, Cancellation
_cancellationToken = cancellationToken;
}
- object IEnumerator.Current => Current;
+ object IEnumerator.Current
+ => Current;
public T Current { get; private set; }
@@ -241,7 +243,6 @@ public async ValueTask MoveNextAsync()
{
if (!_hasExecuted)
{
-
if (!_readItemEnumerable.TryGetResourceId(out var resourceId))
{
throw new InvalidOperationException(CosmosStrings.ResourceIdMissing);
@@ -255,10 +256,10 @@ public async ValueTask MoveNextAsync()
EntityFrameworkEventSource.Log.QueryExecuting();
_item = await _cosmosQueryContext.CosmosClient.ExecuteReadItemAsync(
- _readItemExpression.Container,
- partitionKey,
- resourceId,
- _cancellationToken)
+ _readItemExpression.Container,
+ partitionKey,
+ resourceId,
+ _cancellationToken)
.ConfigureAwait(false);
return ShapeResult();
@@ -288,7 +289,8 @@ public ValueTask DisposeAsync()
return default;
}
- public void Reset() => throw new NotImplementedException();
+ public void Reset()
+ => throw new NotImplementedException();
private bool ShapeResult()
{
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.cs
index b47b34af613..07a56d4df39 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.cs
@@ -4,7 +4,6 @@
using System;
using System.Linq.Expressions;
using JetBrains.Annotations;
-using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Utilities;
using Newtonsoft.Json.Linq;
@@ -66,7 +65,8 @@ protected override Expression VisitShapedQuery(ShapedQueryExpression shapedQuery
selectExpression.ApplyProjection();
shaperBody = new CosmosProjectionBindingRemovingExpressionVisitor(
- selectExpression, jObjectParameter, QueryCompilationContext.QueryTrackingBehavior == QueryTrackingBehavior.TrackAll)
+ selectExpression, jObjectParameter,
+ QueryCompilationContext.QueryTrackingBehavior == QueryTrackingBehavior.TrackAll)
.Visit(shaperBody);
var shaperLambda = Expression.Lambda(
@@ -85,12 +85,14 @@ protected override Expression VisitShapedQuery(ShapedQueryExpression shapedQuery
Expression.Constant(shaperLambda.Compile()),
Expression.Constant(_contextType),
Expression.Constant(_partitionKeyFromExtension, typeof(string)),
- Expression.Constant(QueryCompilationContext.QueryTrackingBehavior == QueryTrackingBehavior.NoTrackingWithIdentityResolution));
+ Expression.Constant(
+ QueryCompilationContext.QueryTrackingBehavior == QueryTrackingBehavior.NoTrackingWithIdentityResolution));
case ReadItemExpression readItemExpression:
shaperBody = new CosmosProjectionBindingRemovingReadItemExpressionVisitor(
- readItemExpression, jObjectParameter, QueryCompilationContext.QueryTrackingBehavior == QueryTrackingBehavior.TrackAll)
+ readItemExpression, jObjectParameter,
+ QueryCompilationContext.QueryTrackingBehavior == QueryTrackingBehavior.TrackAll)
.Visit(shaperBody);
var shaperReadItemLambda = Expression.Lambda(
@@ -106,7 +108,8 @@ protected override Expression VisitShapedQuery(ShapedQueryExpression shapedQuery
Expression.Constant(readItemExpression),
Expression.Constant(shaperReadItemLambda.Compile()),
Expression.Constant(_contextType),
- Expression.Constant(QueryCompilationContext.QueryTrackingBehavior == QueryTrackingBehavior.NoTrackingWithIdentityResolution));
+ Expression.Constant(
+ QueryCompilationContext.QueryTrackingBehavior == QueryTrackingBehavior.NoTrackingWithIdentityResolution));
default:
throw new NotImplementedException();
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs
index 296b399c68b..326ef526292 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs
@@ -12,7 +12,6 @@
using Microsoft.EntityFrameworkCore.Cosmos.Internal;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Storage;
@@ -32,13 +31,16 @@ public class CosmosSqlTranslatingExpressionVisitor : ExpressionVisitor
private static readonly MethodInfo _parameterValueExtractor =
typeof(CosmosSqlTranslatingExpressionVisitor).GetTypeInfo().GetDeclaredMethod(nameof(ParameterValueExtractor));
+
private static readonly MethodInfo _parameterListValueExtractor =
typeof(CosmosSqlTranslatingExpressionVisitor).GetTypeInfo().GetDeclaredMethod(nameof(ParameterListValueExtractor));
private static readonly MethodInfo _concatMethodInfo
= typeof(string).GetRuntimeMethod(nameof(string.Concat), new[] { typeof(object), typeof(object) });
+
private static readonly MethodInfo _stringEqualsWithStringComparison
= typeof(string).GetRuntimeMethod(nameof(string.Equals), new[] { typeof(string), typeof(StringComparison) });
+
private static readonly MethodInfo _stringEqualsWithStringComparisonStatic
= typeof(string).GetRuntimeMethod(nameof(string.Equals), new[] { typeof(string), typeof(string), typeof(StringComparison) });
@@ -184,7 +186,7 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression)
var visitedRight = Visit(right);
if ((binaryExpression.NodeType == ExpressionType.Equal
- || binaryExpression.NodeType == ExpressionType.NotEqual)
+ || binaryExpression.NodeType == ExpressionType.NotEqual)
// Visited expression could be null, We need to pass MemberInitExpression
&& TryRewriteEntityEquality(binaryExpression.NodeType, visitedLeft ?? left, visitedRight ?? right, out var result))
{
@@ -206,12 +208,12 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression)
return TranslationFailed(binaryExpression.Left, visitedLeft, out var sqlLeft)
|| TranslationFailed(binaryExpression.Right, visitedRight, out var sqlRight)
- ? null
- : _sqlExpressionFactory.MakeBinary(
- uncheckedNodeTypeVariant,
- sqlLeft,
- sqlRight,
- null);
+ ? null
+ : _sqlExpressionFactory.MakeBinary(
+ uncheckedNodeTypeVariant,
+ sqlLeft,
+ sqlRight,
+ null);
static bool TryUnwrapConvertToObject(Expression expression, out Expression operand)
{
@@ -246,8 +248,8 @@ protected override Expression VisitConditional(ConditionalExpression conditional
return TranslationFailed(conditionalExpression.Test, test, out var sqlTest)
|| TranslationFailed(conditionalExpression.IfTrue, ifTrue, out var sqlIfTrue)
|| TranslationFailed(conditionalExpression.IfFalse, ifFalse, out var sqlIfFalse)
- ? null
- : _sqlExpressionFactory.Condition(sqlTest, sqlIfTrue, sqlIfFalse);
+ ? null
+ : _sqlExpressionFactory.Condition(sqlTest, sqlIfTrue, sqlIfFalse);
}
///
@@ -298,7 +300,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
case ProjectionBindingExpression projectionBindingExpression:
return projectionBindingExpression.ProjectionMember != null
? ((SelectExpression)projectionBindingExpression.QueryExpression)
- .GetMappedProjection(projectionBindingExpression.ProjectionMember)
+ .GetMappedProjection(projectionBindingExpression.ProjectionMember)
: null;
default:
@@ -312,7 +314,8 @@ protected override Expression VisitExtension(Expression extensionExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- protected override Expression VisitInvocation(InvocationExpression invocationExpression) => null;
+ protected override Expression VisitInvocation(InvocationExpression invocationExpression)
+ => null;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -320,7 +323,8 @@ protected override Expression VisitExtension(Expression extensionExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- protected override Expression VisitLambda(Expression lambdaExpression) => null;
+ protected override Expression VisitLambda(Expression lambdaExpression)
+ => null;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -328,7 +332,8 @@ protected override Expression VisitExtension(Expression extensionExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- protected override Expression VisitListInit(ListInitExpression listInitExpression) => null;
+ protected override Expression VisitListInit(ListInitExpression listInitExpression)
+ => null;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -385,10 +390,11 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
var left = Visit(methodCallExpression.Object);
var right = Visit(RemoveObjectConvert(methodCallExpression.Arguments[0]));
- if (TryRewriteEntityEquality(ExpressionType.Equal,
- left ?? methodCallExpression.Object,
- right ?? methodCallExpression.Arguments[0],
- out var result))
+ if (TryRewriteEntityEquality(
+ ExpressionType.Equal,
+ left ?? methodCallExpression.Object,
+ right ?? methodCallExpression.Arguments[0],
+ out var result))
{
return result;
}
@@ -411,7 +417,8 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
var left = Visit(RemoveObjectConvert(methodCallExpression.Arguments[0]));
var right = Visit(RemoveObjectConvert(methodCallExpression.Arguments[1]));
- if (TryRewriteEntityEquality(ExpressionType.Equal,
+ if (TryRewriteEntityEquality(
+ ExpressionType.Equal,
left ?? methodCallExpression.Arguments[0],
right ?? methodCallExpression.Arguments[1],
out var result))
@@ -504,9 +511,10 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
}
else
{
- AddTranslationErrorDetails(CoreStrings.QueryUnableToTranslateMethod(
- methodCallExpression.Method.DeclaringType?.DisplayName(),
- methodCallExpression.Method.Name));
+ AddTranslationErrorDetails(
+ CoreStrings.QueryUnableToTranslateMethod(
+ methodCallExpression.Method.DeclaringType?.DisplayName(),
+ methodCallExpression.Method.Name));
}
}
@@ -516,8 +524,8 @@ static Expression RemoveObjectConvert(Expression expression)
=> expression is UnaryExpression unaryExpression
&& (unaryExpression.NodeType == ExpressionType.Convert || unaryExpression.NodeType == ExpressionType.ConvertChecked)
&& unaryExpression.Type == typeof(object)
- ? unaryExpression.Operand
- : expression;
+ ? unaryExpression.Operand
+ : expression;
}
///
@@ -535,7 +543,8 @@ protected override Expression VisitNew(NewExpression newExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- protected override Expression VisitNewArray(NewArrayExpression newArrayExpression) => null;
+ protected override Expression VisitNewArray(NewArrayExpression newArrayExpression)
+ => null;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -619,7 +628,8 @@ protected override Expression VisitTypeBinary(TypeBinaryExpression typeBinaryExp
var derivedType = entityType.GetDerivedTypes().SingleOrDefault(et => et.ClrType == typeBinaryExpression.TypeOperand);
if (derivedType != null
- && TryBindMember(entityReferenceExpression,
+ && TryBindMember(
+ entityReferenceExpression,
MemberIdentity.Create(entityType.GetDiscriminatorProperty().Name)) is SqlExpression discriminatorColumn)
{
var concreteEntityTypes = derivedType.GetConcreteDerivedTypesInclusive().ToList();
@@ -646,8 +656,10 @@ private Expression TryBindMember(Expression source, MemberIdentity member)
}
var result = member.MemberInfo != null
- ? entityReferenceExpression.ParameterEntity.BindMember(member.MemberInfo, entityReferenceExpression.Type, clientEval: false, out _)
- : entityReferenceExpression.ParameterEntity.BindMember(member.Name, entityReferenceExpression.Type, clientEval: false, out _);
+ ? entityReferenceExpression.ParameterEntity.BindMember(
+ member.MemberInfo, entityReferenceExpression.Type, clientEval: false, out _)
+ : entityReferenceExpression.ParameterEntity.BindMember(
+ member.Name, entityReferenceExpression.Type, clientEval: false, out _);
if (result == null)
{
@@ -661,7 +673,7 @@ private Expression TryBindMember(Expression source, MemberIdentity member)
{
EntityProjectionExpression entityProjectionExpression => new EntityReferenceExpression(entityProjectionExpression),
ObjectArrayProjectionExpression objectArrayProjectionExpression
- => new EntityReferenceExpression(objectArrayProjectionExpression.InnerProjection),
+ => new EntityReferenceExpression(objectArrayProjectionExpression.InnerProjection),
_ => result
};
}
@@ -723,7 +735,8 @@ private bool TryRewriteContainsEntity(Expression source, Expression item, out Ex
{
case SqlConstantExpression sqlConstantExpression:
var values = (IEnumerable)sqlConstantExpression.Value;
- var propertyValueList = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(property.ClrType.MakeNullable()));
+ var propertyValueList =
+ (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(property.ClrType.MakeNullable()));
var propertyGetter = property.GetGetter();
foreach (var value in values)
{
@@ -734,7 +747,7 @@ private bool TryRewriteContainsEntity(Expression source, Expression item, out Ex
break;
case SqlParameterExpression sqlParameterExpression
- when sqlParameterExpression.Name.StartsWith(QueryCompilationContext.QueryParameterPrefix, StringComparison.Ordinal):
+ when sqlParameterExpression.Name.StartsWith(QueryCompilationContext.QueryParameterPrefix, StringComparison.Ordinal):
var lambda = Expression.Lambda(
Expression.Call(
_parameterListValueExtractor.MakeGenericMethod(entityType.ClrType, property.ClrType.MakeNullable()),
@@ -745,8 +758,8 @@ when sqlParameterExpression.Name.StartsWith(QueryCompilationContext.QueryParamet
);
var newParameterName =
- $"{_runtimeParameterPrefix}" +
- $"{sqlParameterExpression.Name.Substring(QueryCompilationContext.QueryParameterPrefix.Length)}_{property.Name}";
+ $"{_runtimeParameterPrefix}"
+ + $"{sqlParameterExpression.Name.Substring(QueryCompilationContext.QueryParameterPrefix.Length)}_{property.Name}";
rewrittenSource = _queryCompilationContext.RegisterRuntimeParameter(newParameterName, lambda);
break;
@@ -755,10 +768,11 @@ when sqlParameterExpression.Name.StartsWith(QueryCompilationContext.QueryParamet
return false;
}
- result = Visit(Expression.Call(
- EnumerableMethods.Contains.MakeGenericMethod(property.ClrType.MakeNullable()),
- rewrittenSource,
- CreatePropertyAccessExpression(item, property)));
+ result = Visit(
+ Expression.Call(
+ EnumerableMethods.Contains.MakeGenericMethod(property.ClrType.MakeNullable()),
+ rewrittenSource,
+ CreatePropertyAccessExpression(item, property)));
return true;
}
@@ -786,10 +800,13 @@ private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left,
throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType1.DisplayName()));
}
- result = Visit(primaryKeyProperties1.Select(p =>
- Expression.MakeBinary(
- nodeType, CreatePropertyAccessExpression(nonNullEntityReference, p), Expression.Constant(null, p.ClrType.MakeNullable())))
- .Aggregate((l, r) => nodeType == ExpressionType.Equal ? Expression.OrElse(l, r) : Expression.AndAlso(l, r)));
+ result = Visit(
+ primaryKeyProperties1.Select(
+ p =>
+ Expression.MakeBinary(
+ nodeType, CreatePropertyAccessExpression(nonNullEntityReference, p),
+ Expression.Constant(null, p.ClrType.MakeNullable())))
+ .Aggregate((l, r) => nodeType == ExpressionType.Equal ? Expression.OrElse(l, r) : Expression.AndAlso(l, r)));
return true;
}
@@ -814,11 +831,13 @@ private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left,
throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType.DisplayName()));
}
- result = Visit(primaryKeyProperties.Select(p =>
- Expression.MakeBinary(
- nodeType,
- CreatePropertyAccessExpression(left, p),
- CreatePropertyAccessExpression(right, p)))
+ result = Visit(
+ primaryKeyProperties.Select(
+ p =>
+ Expression.MakeBinary(
+ nodeType,
+ CreatePropertyAccessExpression(left, p),
+ CreatePropertyAccessExpression(right, p)))
.Aggregate((l, r) => Expression.AndAlso(l, r)));
return true;
@@ -833,7 +852,7 @@ private Expression CreatePropertyAccessExpression(Expression target, IProperty p
property.GetGetter().GetClrValue(sqlConstantExpression.Value), property.ClrType.MakeNullable());
case SqlParameterExpression sqlParameterExpression
- when sqlParameterExpression.Name.StartsWith(QueryCompilationContext.QueryParameterPrefix, StringComparison.Ordinal):
+ when sqlParameterExpression.Name.StartsWith(QueryCompilationContext.QueryParameterPrefix, StringComparison.Ordinal):
var lambda = Expression.Lambda(
Expression.Call(
_parameterValueExtractor.MakeGenericMethod(property.ClrType.MakeNullable()),
@@ -843,14 +862,14 @@ when sqlParameterExpression.Name.StartsWith(QueryCompilationContext.QueryParamet
QueryCompilationContext.QueryContextParameter);
var newParameterName =
- $"{_runtimeParameterPrefix}" +
- $"{sqlParameterExpression.Name.Substring(QueryCompilationContext.QueryParameterPrefix.Length)}_{property.Name}";
+ $"{_runtimeParameterPrefix}"
+ + $"{sqlParameterExpression.Name.Substring(QueryCompilationContext.QueryParameterPrefix.Length)}_{property.Name}";
return _queryCompilationContext.RegisterRuntimeParameter(newParameterName, lambda);
case MemberInitExpression memberInitExpression
- when memberInitExpression.Bindings.SingleOrDefault(
- mb => mb.Member.Name == property.Name) is MemberAssignment memberAssignment:
+ when memberInitExpression.Bindings.SingleOrDefault(
+ mb => mb.Member.Name == property.Name) is MemberAssignment memberAssignment:
return memberAssignment.Expression;
default:
@@ -865,7 +884,9 @@ private static T ParameterValueExtractor(QueryContext context, string basePar
}
private static List ParameterListValueExtractor(
- QueryContext context, string baseParameterName, IProperty property)
+ QueryContext context,
+ string baseParameterName,
+ IProperty property)
{
if (!(context.ParameterValues[baseParameterName] is IEnumerable baseListParameter))
{
@@ -902,8 +923,8 @@ private static bool CanEvaluate(Expression expression)
case MemberInitExpression memberInitExpression:
return CanEvaluate(memberInitExpression.NewExpression)
- && memberInitExpression.Bindings.All(
- mb => mb is MemberAssignment memberAssignment && CanEvaluate(memberAssignment.Expression));
+ && memberInitExpression.Bindings.All(
+ mb => mb is MemberAssignment memberAssignment && CanEvaluate(memberAssignment.Expression));
default:
return false;
@@ -944,14 +965,16 @@ private EntityReferenceExpression(EntityProjectionExpression parameter, Type typ
public IEntityType EntityType { get; }
public override Type Type { get; }
- public override ExpressionType NodeType => ExpressionType.Extension;
+
+ public override ExpressionType NodeType
+ => ExpressionType.Extension;
public Expression Convert(Type type)
{
return type == typeof(object) // Ignore object conversion
|| type.IsAssignableFrom(Type) // Ignore conversion to base/interface
- ? this
- : new EntityReferenceExpression(ParameterEntity, type);
+ ? this
+ : new EntityReferenceExpression(ParameterEntity, type);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/EntityProjectionExpression.cs b/src/EFCore.Cosmos/Query/Internal/EntityProjectionExpression.cs
index aba843e795a..6ee34818703 100644
--- a/src/EFCore.Cosmos/Query/Internal/EntityProjectionExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/EntityProjectionExpression.cs
@@ -8,8 +8,8 @@
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Cosmos.Internal;
-using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Metadata.Conventions;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Utilities;
@@ -48,7 +48,8 @@ public EntityProjectionExpression([NotNull] IEntityType entityType, [NotNull] Ex
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -56,7 +57,8 @@ public EntityProjectionExpression([NotNull] IEntityType entityType, [NotNull] Ex
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override Type Type => EntityType.ClrType;
+ public override Type Type
+ => EntityType.ClrType;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -130,7 +132,7 @@ public virtual Expression BindProperty([NotNull] IProperty property, bool client
if (!clientEval
// TODO: Remove once __jObject is translated to the access root in a better fashion and
// would not otherwise be found to be non-translatable. See issues #17670 and #14121.
- && property.Name != EntityFrameworkCore.Metadata.Conventions.StoreKeyConvention.JObjectPropertyName
+ && property.Name != StoreKeyConvention.JObjectPropertyName
&& expression.Name.Length == 0)
{
// Non-persisted property can't be translated
@@ -183,7 +185,10 @@ public virtual Expression BindNavigation([NotNull] INavigation navigation, bool
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual Expression BindMember(
- [NotNull] string name, [NotNull] Type entityType, bool clientEval, [NotNull] out IPropertyBase propertyBase)
+ [NotNull] string name,
+ [NotNull] Type entityType,
+ bool clientEval,
+ [NotNull] out IPropertyBase propertyBase)
=> BindMember(MemberIdentity.Create(name), entityType, clientEval, out propertyBase);
///
@@ -193,7 +198,10 @@ public virtual Expression BindMember(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual Expression BindMember(
- [NotNull] MemberInfo memberInfo, [NotNull] Type entityType, bool clientEval, [NotNull] out IPropertyBase propertyBase)
+ [NotNull] MemberInfo memberInfo,
+ [NotNull] Type entityType,
+ bool clientEval,
+ [NotNull] out IPropertyBase propertyBase)
=> BindMember(MemberIdentity.Create(memberInfo), entityType, clientEval, out propertyBase);
private Expression BindMember(MemberIdentity member, Type entityClrType, bool clientEval, out IPropertyBase propertyBase)
@@ -240,8 +248,9 @@ public virtual EntityProjectionExpression UpdateEntityType([NotNull] IEntityType
if (!derivedType.GetAllBaseTypes().Contains(EntityType))
{
- throw new InvalidOperationException(CosmosStrings.InvalidDerivedTypeInEntityProjection(
- derivedType.DisplayName(), EntityType.DisplayName()));
+ throw new InvalidOperationException(
+ CosmosStrings.InvalidDerivedTypeInEntityProjection(
+ derivedType.DisplayName(), EntityType.DisplayName()));
}
return new EntityProjectionExpression(derivedType, AccessExpression);
@@ -268,13 +277,13 @@ void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is EntityProjectionExpression entityProjectionExpression
- && Equals(entityProjectionExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is EntityProjectionExpression entityProjectionExpression
+ && Equals(entityProjectionExpression));
private bool Equals(EntityProjectionExpression entityProjectionExpression)
=> Equals(EntityType, entityProjectionExpression.EntityType)
- && AccessExpression.Equals(entityProjectionExpression.AccessExpression);
+ && AccessExpression.Equals(entityProjectionExpression.AccessExpression);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -282,6 +291,7 @@ private bool Equals(EntityProjectionExpression entityProjectionExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(EntityType, AccessExpression);
+ public override int GetHashCode()
+ => HashCode.Combine(EntityType, AccessExpression);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/EqualsTranslator.cs b/src/EFCore.Cosmos/Query/Internal/EqualsTranslator.cs
index f7104d9d436..2ce9b9713e0 100644
--- a/src/EFCore.Cosmos/Query/Internal/EqualsTranslator.cs
+++ b/src/EFCore.Cosmos/Query/Internal/EqualsTranslator.cs
@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
-using System.Linq.Expressions;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
@@ -39,7 +38,10 @@ public EqualsTranslator([NotNull] ISqlExpressionFactory sqlExpressionFactory)
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual SqlExpression Translate(
- SqlExpression instance, MethodInfo method, IReadOnlyList arguments, IDiagnosticsLogger logger)
+ SqlExpression instance,
+ MethodInfo method,
+ IReadOnlyList arguments,
+ IDiagnosticsLogger logger)
{
Check.NotNull(method, nameof(method));
Check.NotNull(arguments, nameof(arguments));
@@ -56,8 +58,8 @@ public virtual SqlExpression Translate(
right = arguments[0];
}
else if (instance == null
- && method.Name == nameof(object.Equals)
- && arguments.Count == 2)
+ && method.Name == nameof(object.Equals)
+ && arguments.Count == 2)
{
left = arguments[0];
right = arguments[1];
@@ -67,10 +69,10 @@ public virtual SqlExpression Translate(
&& right != null)
{
return left.Type.UnwrapNullableType() == right.Type.UnwrapNullableType()
- || (right.Type == typeof(object) && right is SqlParameterExpression)
- || (left.Type == typeof(object) && left is SqlParameterExpression)
- ? _sqlExpressionFactory.Equal(left, right)
- : (SqlExpression)_sqlExpressionFactory.Constant(false);
+ || (right.Type == typeof(object) && right is SqlParameterExpression)
+ || (left.Type == typeof(object) && left is SqlParameterExpression)
+ ? _sqlExpressionFactory.Equal(left, right)
+ : (SqlExpression)_sqlExpressionFactory.Constant(false);
}
return null;
diff --git a/src/EFCore.Cosmos/Query/Internal/IMemberTranslator.cs b/src/EFCore.Cosmos/Query/Internal/IMemberTranslator.cs
index 01d4d7291e4..556e3cdebb3 100644
--- a/src/EFCore.Cosmos/Query/Internal/IMemberTranslator.cs
+++ b/src/EFCore.Cosmos/Query/Internal/IMemberTranslator.cs
@@ -22,7 +22,10 @@ public interface IMemberTranslator
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- SqlExpression Translate([NotNull] SqlExpression instance, [NotNull] MemberInfo member, [NotNull] Type returnType,
+ SqlExpression Translate(
+ [NotNull] SqlExpression instance,
+ [NotNull] MemberInfo member,
+ [NotNull] Type returnType,
[NotNull] IDiagnosticsLogger logger);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/IMemberTranslatorProvider.cs b/src/EFCore.Cosmos/Query/Internal/IMemberTranslatorProvider.cs
index 86ab4caa381..b4d9cbef372 100644
--- a/src/EFCore.Cosmos/Query/Internal/IMemberTranslatorProvider.cs
+++ b/src/EFCore.Cosmos/Query/Internal/IMemberTranslatorProvider.cs
@@ -22,7 +22,10 @@ public interface IMemberTranslatorProvider
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- SqlExpression Translate([NotNull] SqlExpression instance, [NotNull] MemberInfo member, [NotNull] Type returnType,
+ SqlExpression Translate(
+ [NotNull] SqlExpression instance,
+ [NotNull] MemberInfo member,
+ [NotNull] Type returnType,
[NotNull] IDiagnosticsLogger logger);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/IMethodCallTranslator.cs b/src/EFCore.Cosmos/Query/Internal/IMethodCallTranslator.cs
index a0b323f9388..230f612abb4 100644
--- a/src/EFCore.Cosmos/Query/Internal/IMethodCallTranslator.cs
+++ b/src/EFCore.Cosmos/Query/Internal/IMethodCallTranslator.cs
@@ -23,7 +23,9 @@ public interface IMethodCallTranslator
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
SqlExpression Translate(
- [CanBeNull] SqlExpression instance, [NotNull] MethodInfo method, [NotNull] IReadOnlyList arguments,
+ [CanBeNull] SqlExpression instance,
+ [NotNull] MethodInfo method,
+ [NotNull] IReadOnlyList arguments,
[NotNull] IDiagnosticsLogger logger);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/ISqlExpressionFactory.cs b/src/EFCore.Cosmos/Query/Internal/ISqlExpressionFactory.cs
index a8ff2add268..a245b2bad6a 100644
--- a/src/EFCore.Cosmos/Query/Internal/ISqlExpressionFactory.cs
+++ b/src/EFCore.Cosmos/Query/Internal/ISqlExpressionFactory.cs
@@ -125,7 +125,9 @@ SqlBinaryExpression MakeBinary(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
SqlBinaryExpression Add(
- [NotNull] SqlExpression left, [NotNull] SqlExpression right, [CanBeNull] CoreTypeMapping typeMapping = null);
+ [NotNull] SqlExpression left,
+ [NotNull] SqlExpression right,
+ [CanBeNull] CoreTypeMapping typeMapping = null);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -134,7 +136,9 @@ SqlBinaryExpression Add(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
SqlBinaryExpression Subtract(
- [NotNull] SqlExpression left, [NotNull] SqlExpression right, [CanBeNull] CoreTypeMapping typeMapping = null);
+ [NotNull] SqlExpression left,
+ [NotNull] SqlExpression right,
+ [CanBeNull] CoreTypeMapping typeMapping = null);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -143,7 +147,9 @@ SqlBinaryExpression Subtract(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
SqlBinaryExpression Multiply(
- [NotNull] SqlExpression left, [NotNull] SqlExpression right, [CanBeNull] CoreTypeMapping typeMapping = null);
+ [NotNull] SqlExpression left,
+ [NotNull] SqlExpression right,
+ [CanBeNull] CoreTypeMapping typeMapping = null);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -152,7 +158,9 @@ SqlBinaryExpression Multiply(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
SqlBinaryExpression Divide(
- [NotNull] SqlExpression left, [NotNull] SqlExpression right, [CanBeNull] CoreTypeMapping typeMapping = null);
+ [NotNull] SqlExpression left,
+ [NotNull] SqlExpression right,
+ [CanBeNull] CoreTypeMapping typeMapping = null);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -161,7 +169,9 @@ SqlBinaryExpression Divide(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
SqlBinaryExpression Modulo(
- [NotNull] SqlExpression left, [NotNull] SqlExpression right, [CanBeNull] CoreTypeMapping typeMapping = null);
+ [NotNull] SqlExpression left,
+ [NotNull] SqlExpression right,
+ [CanBeNull] CoreTypeMapping typeMapping = null);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -170,7 +180,9 @@ SqlBinaryExpression Modulo(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
SqlBinaryExpression And(
- [NotNull] SqlExpression left, [NotNull] SqlExpression right, [CanBeNull] CoreTypeMapping typeMapping = null);
+ [NotNull] SqlExpression left,
+ [NotNull] SqlExpression right,
+ [CanBeNull] CoreTypeMapping typeMapping = null);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -179,7 +191,9 @@ SqlBinaryExpression And(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
SqlBinaryExpression Or(
- [NotNull] SqlExpression left, [NotNull] SqlExpression right, [CanBeNull] CoreTypeMapping typeMapping = null);
+ [NotNull] SqlExpression left,
+ [NotNull] SqlExpression right,
+ [CanBeNull] CoreTypeMapping typeMapping = null);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -204,7 +218,9 @@ SqlBinaryExpression Or(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
SqlUnaryExpression Convert(
- [NotNull] SqlExpression operand, [NotNull] Type type, [CanBeNull] CoreTypeMapping typeMapping = null);
+ [NotNull] SqlExpression operand,
+ [NotNull] Type type,
+ [CanBeNull] CoreTypeMapping typeMapping = null);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -241,7 +257,9 @@ SqlFunctionExpression Function(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
SqlConditionalExpression Condition(
- [NotNull] SqlExpression test, [NotNull] SqlExpression ifTrue, [NotNull] SqlExpression ifFalse);
+ [NotNull] SqlExpression test,
+ [NotNull] SqlExpression ifTrue,
+ [NotNull] SqlExpression ifFalse);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.Cosmos/Query/Internal/InExpression.cs b/src/EFCore.Cosmos/Query/Internal/InExpression.cs
index 2e613a510d5..0870340991b 100644
--- a/src/EFCore.Cosmos/Query/Internal/InExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/InExpression.cs
@@ -25,7 +25,10 @@ public class InExpression : SqlExpression
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public InExpression(
- [NotNull] SqlExpression item, bool negated, [NotNull] SqlExpression values, [NotNull] CoreTypeMapping typeMapping)
+ [NotNull] SqlExpression item,
+ bool negated,
+ [NotNull] SqlExpression values,
+ [NotNull] CoreTypeMapping typeMapping)
: base(typeof(bool), typeMapping)
{
Item = item;
@@ -77,7 +80,8 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual InExpression Negate() => new InExpression(Item, !IsNegated, Values, TypeMapping);
+ public virtual InExpression Negate()
+ => new InExpression(Item, !IsNegated, Values, TypeMapping);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -115,15 +119,15 @@ protected override void Print(ExpressionPrinter expressionPrinter)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is InExpression inExpression
- && Equals(inExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is InExpression inExpression
+ && Equals(inExpression));
private bool Equals(InExpression inExpression)
=> base.Equals(inExpression)
- && Item.Equals(inExpression.Item)
- && IsNegated.Equals(inExpression.IsNegated)
- && (Values == null ? inExpression.Values == null : Values.Equals(inExpression.Values));
+ && Item.Equals(inExpression.Item)
+ && IsNegated.Equals(inExpression.IsNegated)
+ && (Values == null ? inExpression.Values == null : Values.Equals(inExpression.Values));
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -131,6 +135,7 @@ private bool Equals(InExpression inExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), Item, IsNegated, Values);
+ public override int GetHashCode()
+ => HashCode.Combine(base.GetHashCode(), Item, IsNegated, Values);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/KeyAccessExpression.cs b/src/EFCore.Cosmos/Query/Internal/KeyAccessExpression.cs
index 097af897885..431f8e22789 100644
--- a/src/EFCore.Cosmos/Query/Internal/KeyAccessExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/KeyAccessExpression.cs
@@ -101,11 +101,12 @@ protected override void Print(ExpressionPrinter expressionPrinter)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override string ToString() => Name?.Length > 0
- ? $"{AccessExpression}[\"{Name}\"]"
- // TODO: Remove once __jObject is translated to the access root in a better fashion.
- // See issue #17670 and related issue #14121.
- : $"{AccessExpression}";
+ public override string ToString()
+ => Name?.Length > 0
+ ? $"{AccessExpression}[\"{Name}\"]"
+ // TODO: Remove once __jObject is translated to the access root in a better fashion.
+ // See issue #17670 and related issue #14121.
+ : $"{AccessExpression}";
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -115,14 +116,14 @@ public override string ToString() => Name?.Length > 0
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is KeyAccessExpression keyAccessExpression
- && Equals(keyAccessExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is KeyAccessExpression keyAccessExpression
+ && Equals(keyAccessExpression));
private bool Equals(KeyAccessExpression keyAccessExpression)
=> base.Equals(keyAccessExpression)
- && string.Equals(Name, keyAccessExpression.Name)
- && AccessExpression.Equals(keyAccessExpression.AccessExpression);
+ && string.Equals(Name, keyAccessExpression.Name)
+ && AccessExpression.Equals(keyAccessExpression.AccessExpression);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -130,6 +131,7 @@ private bool Equals(KeyAccessExpression keyAccessExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), Name, AccessExpression);
+ public override int GetHashCode()
+ => HashCode.Combine(base.GetHashCode(), Name, AccessExpression);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/ObjectAccessExpression.cs b/src/EFCore.Cosmos/Query/Internal/ObjectAccessExpression.cs
index 1b61f498c10..fdaf4466bc0 100644
--- a/src/EFCore.Cosmos/Query/Internal/ObjectAccessExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/ObjectAccessExpression.cs
@@ -45,7 +45,8 @@ public ObjectAccessExpression([NotNull] INavigation navigation, [NotNull] Expres
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override ExpressionType NodeType => ExpressionType.Extension;
+ public override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -53,7 +54,8 @@ public ObjectAccessExpression([NotNull] INavigation navigation, [NotNull] Expres
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override Type Type => Navigation.ClrType;
+ public override Type Type
+ => Navigation.ClrType;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -122,7 +124,8 @@ void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override string ToString() => $"{AccessExpression}[\"{Name}\"]";
+ public override string ToString()
+ => $"{AccessExpression}[\"{Name}\"]";
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -132,13 +135,13 @@ void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is ObjectAccessExpression objectAccessExpression
- && Equals(objectAccessExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is ObjectAccessExpression objectAccessExpression
+ && Equals(objectAccessExpression));
private bool Equals(ObjectAccessExpression objectAccessExpression)
=> Navigation == objectAccessExpression.Navigation
- && AccessExpression.Equals(objectAccessExpression.AccessExpression);
+ && AccessExpression.Equals(objectAccessExpression.AccessExpression);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -146,6 +149,7 @@ private bool Equals(ObjectAccessExpression objectAccessExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(Navigation, AccessExpression);
+ public override int GetHashCode()
+ => HashCode.Combine(Navigation, AccessExpression);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/ObjectArrayProjectionExpression.cs b/src/EFCore.Cosmos/Query/Internal/ObjectArrayProjectionExpression.cs
index cf04b3835ab..d1e52e733c1 100644
--- a/src/EFCore.Cosmos/Query/Internal/ObjectArrayProjectionExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/ObjectArrayProjectionExpression.cs
@@ -44,9 +44,10 @@ public ObjectArrayProjectionExpression(
Navigation = navigation;
AccessExpression = accessExpression;
- InnerProjection = innerProjection ?? new EntityProjectionExpression(
- targetType,
- new RootReferenceExpression(targetType, ""));
+ InnerProjection = innerProjection
+ ?? new EntityProjectionExpression(
+ targetType,
+ new RootReferenceExpression(targetType, ""));
}
///
@@ -55,7 +56,8 @@ public ObjectArrayProjectionExpression(
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -120,7 +122,8 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual ObjectArrayProjectionExpression Update(
- [NotNull] Expression accessExpression, [NotNull] EntityProjectionExpression innerProjection)
+ [NotNull] Expression accessExpression,
+ [NotNull] EntityProjectionExpression innerProjection)
=> accessExpression != AccessExpression || innerProjection != InnerProjection
? new ObjectArrayProjectionExpression(Navigation, accessExpression, innerProjection)
: this;
@@ -144,7 +147,8 @@ void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override string ToString() => $"{AccessExpression}[\"{Name}\"]";
+ public override string ToString()
+ => $"{AccessExpression}[\"{Name}\"]";
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -154,13 +158,13 @@ void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is ObjectArrayProjectionExpression arrayProjectionExpression
- && Equals(arrayProjectionExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is ObjectArrayProjectionExpression arrayProjectionExpression
+ && Equals(arrayProjectionExpression));
private bool Equals(ObjectArrayProjectionExpression objectArrayProjectionExpression)
=> AccessExpression.Equals(objectArrayProjectionExpression.AccessExpression)
- && InnerProjection.Equals(objectArrayProjectionExpression.InnerProjection);
+ && InnerProjection.Equals(objectArrayProjectionExpression.InnerProjection);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -168,6 +172,7 @@ private bool Equals(ObjectArrayProjectionExpression objectArrayProjectionExpress
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(AccessExpression, InnerProjection);
+ public override int GetHashCode()
+ => HashCode.Combine(AccessExpression, InnerProjection);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/OrderingExpression.cs b/src/EFCore.Cosmos/Query/Internal/OrderingExpression.cs
index fcc3a6320f2..016ef5dfa79 100644
--- a/src/EFCore.Cosmos/Query/Internal/OrderingExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/OrderingExpression.cs
@@ -51,7 +51,8 @@ public OrderingExpression([NotNull] SqlExpression expression, bool ascending)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -59,7 +60,8 @@ public OrderingExpression([NotNull] SqlExpression expression, bool ascending)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override Type Type => Expression.Type;
+ public override Type Type
+ => Expression.Type;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -108,13 +110,13 @@ void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is OrderingExpression orderingExpression
- && Equals(orderingExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is OrderingExpression orderingExpression
+ && Equals(orderingExpression));
private bool Equals(OrderingExpression orderingExpression)
=> Expression.Equals(orderingExpression.Expression)
- && IsAscending == orderingExpression.IsAscending;
+ && IsAscending == orderingExpression.IsAscending;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -122,6 +124,7 @@ private bool Equals(OrderingExpression orderingExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(Expression, IsAscending);
+ public override int GetHashCode()
+ => HashCode.Combine(Expression, IsAscending);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/ProjectionExpression.cs b/src/EFCore.Cosmos/Query/Internal/ProjectionExpression.cs
index 6ae428716f5..c2d029fb525 100644
--- a/src/EFCore.Cosmos/Query/Internal/ProjectionExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/ProjectionExpression.cs
@@ -60,7 +60,8 @@ public virtual string Name
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override Type Type => Expression.Type;
+ public override Type Type
+ => Expression.Type;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -68,7 +69,8 @@ public virtual string Name
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -120,13 +122,13 @@ void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is ProjectionExpression projectionExpression
- && Equals(projectionExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is ProjectionExpression projectionExpression
+ && Equals(projectionExpression));
private bool Equals(ProjectionExpression projectionExpression)
=> string.Equals(Alias, projectionExpression.Alias)
- && Expression.Equals(projectionExpression.Expression);
+ && Expression.Equals(projectionExpression.Expression);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -134,6 +136,7 @@ private bool Equals(ProjectionExpression projectionExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(Alias, Expression);
+ public override int GetHashCode()
+ => HashCode.Combine(Alias, Expression);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/QuerySqlGenerator.cs b/src/EFCore.Cosmos/Query/Internal/QuerySqlGenerator.cs
index 51958a2d5eb..0b6082c4d07 100644
--- a/src/EFCore.Cosmos/Query/Internal/QuerySqlGenerator.cs
+++ b/src/EFCore.Cosmos/Query/Internal/QuerySqlGenerator.cs
@@ -70,7 +70,8 @@ public class QuerySqlGenerator : SqlExpressionVisitor
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual CosmosSqlQuery GetSqlQuery(
- [NotNull] SelectExpression selectExpression, [NotNull] IReadOnlyDictionary parameterValues)
+ [NotNull] SelectExpression selectExpression,
+ [NotNull] IReadOnlyDictionary parameterValues)
{
_sqlBuilder.Clear();
_parameterValues = parameterValues;
diff --git a/src/EFCore.Cosmos/Query/Internal/QuerySqlGeneratorFactory.cs b/src/EFCore.Cosmos/Query/Internal/QuerySqlGeneratorFactory.cs
index 7d89de2e6c4..1bbb56ca865 100644
--- a/src/EFCore.Cosmos/Query/Internal/QuerySqlGeneratorFactory.cs
+++ b/src/EFCore.Cosmos/Query/Internal/QuerySqlGeneratorFactory.cs
@@ -17,6 +17,7 @@ public class QuerySqlGeneratorFactory : IQuerySqlGeneratorFactory
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual QuerySqlGenerator Create() => new QuerySqlGenerator();
+ public virtual QuerySqlGenerator Create()
+ => new QuerySqlGenerator();
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/ReadItemExpression.cs b/src/EFCore.Cosmos/Query/Internal/ReadItemExpression.cs
index 570e6df23f2..fc9eb8383fe 100644
--- a/src/EFCore.Cosmos/Query/Internal/ReadItemExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/ReadItemExpression.cs
@@ -7,7 +7,6 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Utilities;
-using Newtonsoft.Json.Linq;
namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal
{
@@ -27,7 +26,8 @@ public class ReadItemExpression : Expression
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override Type Type => typeof(object);
+ public override Type Type
+ => typeof(object);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -35,7 +35,8 @@ public class ReadItemExpression : Expression
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override ExpressionType NodeType => ExpressionType.Extension;
+ public override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.Cosmos/Query/Internal/RootReferenceExpression.cs b/src/EFCore.Cosmos/Query/Internal/RootReferenceExpression.cs
index bb0bfdfcf21..7ebf7f23dbf 100644
--- a/src/EFCore.Cosmos/Query/Internal/RootReferenceExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/RootReferenceExpression.cs
@@ -35,7 +35,8 @@ public RootReferenceExpression([NotNull] IEntityType entityType, [NotNull] strin
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -43,7 +44,8 @@ public RootReferenceExpression([NotNull] IEntityType entityType, [NotNull] strin
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override Type Type => EntityType.ClrType;
+ public override Type Type
+ => EntityType.ClrType;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -67,7 +69,8 @@ public RootReferenceExpression([NotNull] IEntityType entityType, [NotNull] strin
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- string IAccessExpression.Name => Alias;
+ string IAccessExpression.Name
+ => Alias;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -88,7 +91,8 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override string ToString() => Alias;
+ public override string ToString()
+ => Alias;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -98,13 +102,13 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is RootReferenceExpression rootReferenceExpression
- && Equals(rootReferenceExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is RootReferenceExpression rootReferenceExpression
+ && Equals(rootReferenceExpression));
private bool Equals(RootReferenceExpression rootReferenceExpression)
=> string.Equals(Alias, rootReferenceExpression.Alias)
- && EntityType.Equals(rootReferenceExpression.EntityType);
+ && EntityType.Equals(rootReferenceExpression.EntityType);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -112,6 +116,7 @@ private bool Equals(RootReferenceExpression rootReferenceExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(Alias, EntityType);
+ public override int GetHashCode()
+ => HashCode.Combine(Alias, EntityType);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/SelectExpression.cs b/src/EFCore.Cosmos/Query/Internal/SelectExpression.cs
index e96224f2930..cae99b0795c 100644
--- a/src/EFCore.Cosmos/Query/Internal/SelectExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/SelectExpression.cs
@@ -84,7 +84,8 @@ private SelectExpression(
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual IReadOnlyList Projection => _projection;
+ public virtual IReadOnlyList Projection
+ => _projection;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -100,7 +101,8 @@ private SelectExpression(
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual IReadOnlyList Orderings => _orderings;
+ public virtual IReadOnlyList Orderings
+ => _orderings;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -143,7 +145,6 @@ private SelectExpression(
public virtual Expression GetMappedProjection([NotNull] ProjectionMember projectionMember)
=> _projectionMapping[projectionMember];
-
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
@@ -170,12 +171,11 @@ public virtual string GetPartitionKey([NotNull] IReadOnlyDictionary
- public virtual int AddToProjection([NotNull] ObjectArrayProjectionExpression objectArrayProjection) =>
- AddToProjection(objectArrayProjection, null);
+ public virtual int AddToProjection([NotNull] ObjectArrayProjectionExpression objectArrayProjection)
+ => AddToProjection(objectArrayProjection, null);
private int AddToProjection([NotNull] Expression expression, string alias)
{
@@ -260,8 +260,8 @@ private int AddToProjection([NotNull] Expression expression, string alias)
}
var baseAlias = alias
- ?? (expression as IAccessExpression)?.Name
- ?? "c";
+ ?? (expression as IAccessExpression)?.Name
+ ?? "c";
var currentAlias = baseAlias;
var counter = 0;
@@ -421,7 +421,8 @@ public virtual void ReverseOrderings()
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override Type Type => typeof(object);
+ public override Type Type
+ => typeof(object);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -429,7 +430,8 @@ public virtual void ReverseOrderings()
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.Cosmos/Query/Internal/SqlBinaryExpression.cs b/src/EFCore.Cosmos/Query/Internal/SqlBinaryExpression.cs
index 34e9f16c7bb..911d127a788 100644
--- a/src/EFCore.Cosmos/Query/Internal/SqlBinaryExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/SqlBinaryExpression.cs
@@ -6,7 +6,6 @@
using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Cosmos.Internal;
-using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Storage;
@@ -47,8 +46,9 @@ public class SqlBinaryExpression : SqlExpression
private static ExpressionType VerifyOperator(ExpressionType operatorType)
=> _allowedOperators.Contains(operatorType)
? operatorType
- : throw new InvalidOperationException(CosmosStrings.UnsupportedOperatorForSqlExpression(
- operatorType, typeof(SqlBinaryExpression).ShortDisplayName()));
+ : throw new InvalidOperationException(
+ CosmosStrings.UnsupportedOperatorForSqlExpression(
+ operatorType, typeof(SqlBinaryExpression).ShortDisplayName()));
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -164,7 +164,8 @@ protected override void Print(ExpressionPrinter expressionPrinter)
expressionPrinter.Append(")");
}
- static bool RequiresBrackets(SqlExpression expression) => expression is SqlBinaryExpression;
+ static bool RequiresBrackets(SqlExpression expression)
+ => expression is SqlBinaryExpression;
}
///
@@ -175,15 +176,15 @@ protected override void Print(ExpressionPrinter expressionPrinter)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is SqlBinaryExpression sqlBinaryExpression
- && Equals(sqlBinaryExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is SqlBinaryExpression sqlBinaryExpression
+ && Equals(sqlBinaryExpression));
private bool Equals(SqlBinaryExpression sqlBinaryExpression)
=> base.Equals(sqlBinaryExpression)
- && OperatorType == sqlBinaryExpression.OperatorType
- && Left.Equals(sqlBinaryExpression.Left)
- && Right.Equals(sqlBinaryExpression.Right);
+ && OperatorType == sqlBinaryExpression.OperatorType
+ && Left.Equals(sqlBinaryExpression.Left)
+ && Right.Equals(sqlBinaryExpression.Right);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -191,6 +192,7 @@ private bool Equals(SqlBinaryExpression sqlBinaryExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), OperatorType, Left, Right);
+ public override int GetHashCode()
+ => HashCode.Combine(base.GetHashCode(), OperatorType, Left, Right);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/SqlConditionalExpression.cs b/src/EFCore.Cosmos/Query/Internal/SqlConditionalExpression.cs
index 344e152a7a3..02d190afb65 100644
--- a/src/EFCore.Cosmos/Query/Internal/SqlConditionalExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/SqlConditionalExpression.cs
@@ -116,15 +116,15 @@ protected override void Print(ExpressionPrinter expressionPrinter)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is SqlConditionalExpression sqlConditionalExpression
- && Equals(sqlConditionalExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is SqlConditionalExpression sqlConditionalExpression
+ && Equals(sqlConditionalExpression));
private bool Equals(SqlConditionalExpression sqlConditionalExpression)
=> base.Equals(sqlConditionalExpression)
- && Test.Equals(sqlConditionalExpression.Test)
- && IfTrue.Equals(sqlConditionalExpression.IfTrue)
- && IfFalse.Equals(sqlConditionalExpression.IfFalse);
+ && Test.Equals(sqlConditionalExpression.Test)
+ && IfTrue.Equals(sqlConditionalExpression.IfTrue)
+ && IfFalse.Equals(sqlConditionalExpression.IfFalse);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.Cosmos/Query/Internal/SqlConstantExpression.cs b/src/EFCore.Cosmos/Query/Internal/SqlConstantExpression.cs
index 677104f2627..42a6a5f3ce7 100644
--- a/src/EFCore.Cosmos/Query/Internal/SqlConstantExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/SqlConstantExpression.cs
@@ -42,7 +42,8 @@ public SqlConstantExpression([NotNull] ConstantExpression constantExpression, [N
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual object Value => _constantExpression.Value;
+ public virtual object Value
+ => _constantExpression.Value;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -138,15 +139,15 @@ private JToken GenerateJToken(object value, CoreTypeMapping typeMapping)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is SqlConstantExpression sqlConstantExpression
- && Equals(sqlConstantExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is SqlConstantExpression sqlConstantExpression
+ && Equals(sqlConstantExpression));
private bool Equals(SqlConstantExpression sqlConstantExpression)
=> base.Equals(sqlConstantExpression)
- && (Value == null
- ? sqlConstantExpression.Value == null
- : Value.Equals(sqlConstantExpression.Value));
+ && (Value == null
+ ? sqlConstantExpression.Value == null
+ : Value.Equals(sqlConstantExpression.Value));
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -154,6 +155,7 @@ private bool Equals(SqlConstantExpression sqlConstantExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), Value);
+ public override int GetHashCode()
+ => HashCode.Combine(base.GetHashCode(), Value);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/SqlExpression.cs b/src/EFCore.Cosmos/Query/Internal/SqlExpression.cs
index dd5da5b8c72..86a90b72259 100644
--- a/src/EFCore.Cosmos/Query/Internal/SqlExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/SqlExpression.cs
@@ -5,7 +5,6 @@
using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Cosmos.Internal;
-using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Storage;
@@ -62,7 +61,8 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -73,7 +73,8 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
protected abstract void Print([NotNull] ExpressionPrinter expressionPrinter);
///
- void IPrintableExpression.Print(ExpressionPrinter expressionPrinter) => Print(expressionPrinter);
+ void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
+ => Print(expressionPrinter);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -83,13 +84,13 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is SqlExpression sqlExpression
- && Equals(sqlExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is SqlExpression sqlExpression
+ && Equals(sqlExpression));
private bool Equals(SqlExpression sqlExpression)
=> Type == sqlExpression.Type
- && TypeMapping?.Equals(sqlExpression.TypeMapping) == true;
+ && TypeMapping?.Equals(sqlExpression.TypeMapping) == true;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -97,6 +98,7 @@ private bool Equals(SqlExpression sqlExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(Type, TypeMapping);
+ public override int GetHashCode()
+ => HashCode.Combine(Type, TypeMapping);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs b/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs
index d8b291430af..e565a2f3855 100644
--- a/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs
+++ b/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs
@@ -7,7 +7,6 @@
using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Cosmos.Internal;
-using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
@@ -49,8 +48,8 @@ public virtual SqlExpression ApplyDefaultTypeMapping(SqlExpression sqlExpression
{
return sqlExpression == null
|| sqlExpression.TypeMapping != null
- ? sqlExpression
- : ApplyTypeMapping(sqlExpression, _typeMappingSource.FindMapping(sqlExpression.Type));
+ ? sqlExpression
+ : ApplyTypeMapping(sqlExpression, _typeMappingSource.FindMapping(sqlExpression.Type));
}
///
@@ -95,7 +94,8 @@ public virtual SqlExpression ApplyTypeMapping(SqlExpression sqlExpression, CoreT
}
private SqlExpression ApplyTypeMappingOnSqlConditional(
- SqlConditionalExpression sqlConditionalExpression, CoreTypeMapping typeMapping)
+ SqlConditionalExpression sqlConditionalExpression,
+ CoreTypeMapping typeMapping)
{
return sqlConditionalExpression.Update(
sqlConditionalExpression.Test,
@@ -104,7 +104,8 @@ private SqlExpression ApplyTypeMappingOnSqlConditional(
}
private SqlExpression ApplyTypeMappingOnSqlUnary(
- SqlUnaryExpression sqlUnaryExpression, CoreTypeMapping typeMapping)
+ SqlUnaryExpression sqlUnaryExpression,
+ CoreTypeMapping typeMapping)
{
SqlExpression operand;
Type resultType;
@@ -138,15 +139,18 @@ when sqlUnaryExpression.IsLogicalNot():
break;
default:
- throw new InvalidOperationException(CosmosStrings.UnsupportedOperatorForSqlExpression(
- sqlUnaryExpression.OperatorType, typeof(SqlUnaryExpression).ShortDisplayName()));;
+ throw new InvalidOperationException(
+ CosmosStrings.UnsupportedOperatorForSqlExpression(
+ sqlUnaryExpression.OperatorType, typeof(SqlUnaryExpression).ShortDisplayName()));
+ ;
}
return new SqlUnaryExpression(sqlUnaryExpression.OperatorType, operand, resultType, resultTypeMapping);
}
private SqlExpression ApplyTypeMappingOnSqlBinary(
- SqlBinaryExpression sqlBinaryExpression, CoreTypeMapping typeMapping)
+ SqlBinaryExpression sqlBinaryExpression,
+ CoreTypeMapping typeMapping)
{
var left = sqlBinaryExpression.Left;
var right = sqlBinaryExpression.Right;
@@ -171,7 +175,7 @@ private SqlExpression ApplyTypeMappingOnSqlBinary(
resultType = typeof(bool);
resultTypeMapping = _boolTypeMapping;
}
- break;
+ break;
case ExpressionType.AndAlso:
case ExpressionType.OrElse:
@@ -180,7 +184,7 @@ private SqlExpression ApplyTypeMappingOnSqlBinary(
resultType = typeof(bool);
resultTypeMapping = _boolTypeMapping;
}
- break;
+ break;
case ExpressionType.Add:
case ExpressionType.Subtract:
@@ -196,11 +200,12 @@ private SqlExpression ApplyTypeMappingOnSqlBinary(
resultType = inferredTypeMapping?.ClrType ?? left.Type;
resultTypeMapping = inferredTypeMapping;
}
- break;
+ break;
default:
- throw new InvalidOperationException(CosmosStrings.UnsupportedOperatorForSqlExpression(
- sqlBinaryExpression.OperatorType, typeof(SqlBinaryExpression).ShortDisplayName()));
+ throw new InvalidOperationException(
+ CosmosStrings.UnsupportedOperatorForSqlExpression(
+ sqlBinaryExpression.OperatorType, typeof(SqlBinaryExpression).ShortDisplayName()));
}
return new SqlBinaryExpression(
@@ -227,7 +232,10 @@ public virtual CoreTypeMapping FindMapping(Type type)
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual SqlBinaryExpression MakeBinary(
- ExpressionType operatorType, SqlExpression left, SqlExpression right, CoreTypeMapping typeMapping)
+ ExpressionType operatorType,
+ SqlExpression left,
+ SqlExpression right,
+ CoreTypeMapping typeMapping)
{
var returnType = left.Type;
switch (operatorType)
@@ -384,7 +392,10 @@ public virtual SqlBinaryExpression Or(SqlExpression left, SqlExpression right, C
=> MakeBinary(ExpressionType.Or, left, right, typeMapping);
private SqlUnaryExpression MakeUnary(
- ExpressionType operatorType, SqlExpression operand, Type type, CoreTypeMapping typeMapping = null)
+ ExpressionType operatorType,
+ SqlExpression operand,
+ Type type,
+ CoreTypeMapping typeMapping = null)
{
return (SqlUnaryExpression)ApplyTypeMapping(new SqlUnaryExpression(operatorType, operand, type, null), typeMapping);
}
@@ -441,7 +452,10 @@ public virtual SqlUnaryExpression Negate(SqlExpression operand)
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual SqlFunctionExpression Function(
- string functionName, IEnumerable arguments, Type returnType, CoreTypeMapping typeMapping = null)
+ string functionName,
+ IEnumerable arguments,
+ Type returnType,
+ CoreTypeMapping typeMapping = null)
{
var typeMappedArguments = new List();
diff --git a/src/EFCore.Cosmos/Query/Internal/SqlFunctionExpression.cs b/src/EFCore.Cosmos/Query/Internal/SqlFunctionExpression.cs
index 6568006231f..7510757fe05 100644
--- a/src/EFCore.Cosmos/Query/Internal/SqlFunctionExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/SqlFunctionExpression.cs
@@ -128,14 +128,14 @@ protected override void Print(ExpressionPrinter expressionPrinter)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is SqlFunctionExpression sqlFunctionExpression
- && Equals(sqlFunctionExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is SqlFunctionExpression sqlFunctionExpression
+ && Equals(sqlFunctionExpression));
private bool Equals(SqlFunctionExpression sqlFunctionExpression)
=> base.Equals(sqlFunctionExpression)
- && string.Equals(Name, sqlFunctionExpression.Name)
- && Arguments.SequenceEqual(sqlFunctionExpression.Arguments);
+ && string.Equals(Name, sqlFunctionExpression.Name)
+ && Arguments.SequenceEqual(sqlFunctionExpression.Arguments);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.Cosmos/Query/Internal/SqlParameterExpression.cs b/src/EFCore.Cosmos/Query/Internal/SqlParameterExpression.cs
index b92b6bbedf3..3dde9f42b70 100644
--- a/src/EFCore.Cosmos/Query/Internal/SqlParameterExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/SqlParameterExpression.cs
@@ -38,7 +38,8 @@ public SqlParameterExpression([NotNull] ParameterExpression parameterExpression,
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public string Name => _parameterExpression.Name;
+ public string Name
+ => _parameterExpression.Name;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -97,6 +98,7 @@ private bool Equals(SqlParameterExpression sqlParameterExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), Name);
+ public override int GetHashCode()
+ => HashCode.Combine(base.GetHashCode(), Name);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/SqlUnaryExpression.cs b/src/EFCore.Cosmos/Query/Internal/SqlUnaryExpression.cs
index 86ceb83c5ad..d7dae6a93f6 100644
--- a/src/EFCore.Cosmos/Query/Internal/SqlUnaryExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/SqlUnaryExpression.cs
@@ -6,7 +6,6 @@
using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Cosmos.Internal;
-using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Storage;
@@ -24,14 +23,17 @@ public class SqlUnaryExpression : SqlExpression
{
private static readonly ISet _allowedOperators = new HashSet
{
- ExpressionType.Not, ExpressionType.Negate, ExpressionType.UnaryPlus
+ ExpressionType.Not,
+ ExpressionType.Negate,
+ ExpressionType.UnaryPlus
};
private static ExpressionType VerifyOperator(ExpressionType operatorType)
=> _allowedOperators.Contains(operatorType)
? operatorType
- : throw new InvalidOperationException(CosmosStrings.UnsupportedOperatorForSqlExpression(
- operatorType, typeof(SqlUnaryExpression).ShortDisplayName()));
+ : throw new InvalidOperationException(
+ CosmosStrings.UnsupportedOperatorForSqlExpression(
+ operatorType, typeof(SqlUnaryExpression).ShortDisplayName()));
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -115,14 +117,14 @@ protected override void Print(ExpressionPrinter expressionPrinter)
///
public override bool Equals(object obj)
=> obj != null
- && (ReferenceEquals(this, obj)
- || obj is SqlUnaryExpression sqlUnaryExpression
- && Equals(sqlUnaryExpression));
+ && (ReferenceEquals(this, obj)
+ || obj is SqlUnaryExpression sqlUnaryExpression
+ && Equals(sqlUnaryExpression));
private bool Equals(SqlUnaryExpression sqlUnaryExpression)
=> base.Equals(sqlUnaryExpression)
- && OperatorType == sqlUnaryExpression.OperatorType
- && Operand.Equals(sqlUnaryExpression.Operand);
+ && OperatorType == sqlUnaryExpression.OperatorType
+ && Operand.Equals(sqlUnaryExpression.Operand);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -130,6 +132,7 @@ private bool Equals(SqlUnaryExpression sqlUnaryExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), OperatorType, Operand);
+ public override int GetHashCode()
+ => HashCode.Combine(base.GetHashCode(), OperatorType, Operand);
}
}
diff --git a/src/EFCore.Cosmos/Query/Internal/StringMethodTranslator.cs b/src/EFCore.Cosmos/Query/Internal/StringMethodTranslator.cs
index 99e30a84739..85c707090d5 100644
--- a/src/EFCore.Cosmos/Query/Internal/StringMethodTranslator.cs
+++ b/src/EFCore.Cosmos/Query/Internal/StringMethodTranslator.cs
@@ -29,14 +29,14 @@ private static readonly MethodInfo _endsWithMethodInfo
= typeof(string).GetRuntimeMethod(nameof(string.EndsWith), new[] { typeof(string) });
private static readonly MethodInfo _firstOrDefaultMethodInfoWithoutArgs
- = typeof(Enumerable).GetRuntimeMethods().Single(
- m => m.Name == nameof(Enumerable.FirstOrDefault)
- && m.GetParameters().Length == 1).MakeGenericMethod(new[] { typeof(char) });
+ = typeof(Enumerable).GetRuntimeMethods().Single(
+ m => m.Name == nameof(Enumerable.FirstOrDefault)
+ && m.GetParameters().Length == 1).MakeGenericMethod(typeof(char));
private static readonly MethodInfo _lastOrDefaultMethodInfoWithoutArgs
- = typeof(Enumerable).GetRuntimeMethods().Single(
+ = typeof(Enumerable).GetRuntimeMethods().Single(
m => m.Name == nameof(Enumerable.LastOrDefault)
- && m.GetParameters().Length == 1).MakeGenericMethod(new[] { typeof(char) });
+ && m.GetParameters().Length == 1).MakeGenericMethod(typeof(char));
private readonly ISqlExpressionFactory _sqlExpressionFactory;
@@ -58,7 +58,10 @@ public StringMethodTranslator([NotNull] ISqlExpressionFactory sqlExpressionFacto
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual SqlExpression Translate(
- SqlExpression instance, MethodInfo method, IReadOnlyList arguments, IDiagnosticsLogger logger)
+ SqlExpression instance,
+ MethodInfo method,
+ IReadOnlyList arguments,
+ IDiagnosticsLogger logger)
{
Check.NotNull(method, nameof(method));
Check.NotNull(arguments, nameof(arguments));
@@ -74,7 +77,6 @@ public virtual SqlExpression Translate(
return TranslateSystemFunction("LEFT", arguments[0], _sqlExpressionFactory.Constant(1), typeof(char));
}
-
if (_lastOrDefaultMethodInfoWithoutArgs.Equals(method))
{
return TranslateSystemFunction("RIGHT", arguments[0], _sqlExpressionFactory.Constant(1), typeof(char));
diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs
index 72de1c6bf3e..198768949a1 100644
--- a/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs
@@ -92,7 +92,8 @@ public CosmosClientWrapper(
_commandLogger = commandLogger;
}
- private CosmosClient Client => _singletonWrapper.Client;
+ private CosmosClient Client
+ => _singletonWrapper.Client;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -582,7 +583,8 @@ private IAsyncEnumerable CreateQuery(
var queryDefinition = new QueryDefinition(query.Query);
queryDefinition = query.Parameters
- .Aggregate(queryDefinition,
+ .Aggregate(
+ queryDefinition,
(current, parameter) => current.WithParameter(parameter.Name, parameter.Value));
if (string.IsNullOrEmpty(partitionKey))
@@ -610,7 +612,6 @@ private async Task CreateSingleItemQuery(
.ConfigureAwait(false);
}
-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static JsonTextReader CreateJsonReader(TextReader reader)
{
@@ -678,9 +679,11 @@ public DocumentEnumerable(
_cosmosSqlQuery = cosmosSqlQuery;
}
- public IEnumerator GetEnumerator() => new Enumerator(this);
+ public IEnumerator GetEnumerator()
+ => new Enumerator(this);
- IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
+ IEnumerator IEnumerable.GetEnumerator()
+ => GetEnumerator();
private sealed class Enumerator : IEnumerator
{
@@ -703,9 +706,11 @@ public Enumerator(DocumentEnumerable documentEnumerable)
_partitionKey = documentEnumerable._partitionKey;
_cosmosSqlQuery = documentEnumerable._cosmosSqlQuery;
}
+
public JObject Current { get; private set; }
- object IEnumerator.Current => Current;
+ object IEnumerator.Current
+ => Current;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool MoveNext()
@@ -713,7 +718,7 @@ public bool MoveNext()
if (_jsonReader == null)
{
_query ??= _cosmosClientWrapper.CreateQuery(_containerId, _partitionKey, _cosmosSqlQuery).GetAsyncEnumerator();
-
+
if (!_query.MoveNextAsync().AsTask().GetAwaiter().GetResult())
{
Current = default;
@@ -757,7 +762,8 @@ public void Dispose()
_response = null;
}
- public void Reset() => throw new NotImplementedException();
+ public void Reset()
+ => throw new NotImplementedException();
}
}
@@ -816,7 +822,8 @@ public async ValueTask MoveNextAsync()
if (_jsonReader == null)
{
- _query ??= _cosmosClientWrapper.CreateQuery(_containerId, _partitionKey, _cosmosSqlQuery).GetAsyncEnumerator(_cancellationToken);
+ _query ??= _cosmosClientWrapper.CreateQuery(_containerId, _partitionKey, _cosmosSqlQuery)
+ .GetAsyncEnumerator(_cancellationToken);
if (!await _query.MoveNextAsync().ConfigureAwait(false))
{
diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosConcurrencyMode.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosConcurrencyMode.cs
index 7a01a4916a0..c69cc7dc06e 100644
--- a/src/EFCore.Cosmos/Storage/Internal/CosmosConcurrencyMode.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/CosmosConcurrencyMode.cs
@@ -12,17 +12,17 @@ namespace Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal
public enum CosmosConcurrencyMode
{
///
- /// No concurrency check.
+ /// No concurrency check.
///
None = 0,
///
- /// Accept if token matches current value.
+ /// Accept if token matches current value.
///
IfMatch,
///
- /// Accept if token does not match current value.
+ /// Accept if token does not match current value.
///
IfNoneMatch = 2,
}
diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseCreator.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseCreator.cs
index 3cf2d0685a3..3d4740318cb 100644
--- a/src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseCreator.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseCreator.cs
@@ -148,7 +148,8 @@ private IUpdateAdapter AddSeedData()
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual bool EnsureDeleted() => _cosmosClient.DeleteDatabase();
+ public virtual bool EnsureDeleted()
+ => _cosmosClient.DeleteDatabase();
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseWrapper.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseWrapper.cs
index e9e85f4dc5f..1f47920376e 100644
--- a/src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseWrapper.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseWrapper.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using Azure.Cosmos;
@@ -20,8 +21,6 @@
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Linq;
-using Database = Microsoft.EntityFrameworkCore.Storage.Database;
-
namespace Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal
{
///
@@ -143,7 +142,8 @@ public override int SaveChanges(IList entries)
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public override async Task SaveChangesAsync(
- IList entries, CancellationToken cancellationToken = default)
+ IList entries,
+ CancellationToken cancellationToken = default)
{
var rowsAffected = 0;
var entriesSaved = new HashSet();
@@ -395,9 +395,9 @@ private Exception ThrowUpdateException(CosmosException exception, IUpdateEntry e
throw exception.Status switch
{
(int)HttpStatusCode.PreconditionFailed =>
- new DbUpdateConcurrencyException(CosmosStrings.UpdateConflict(id), exception, new[] { entry }),
+ new DbUpdateConcurrencyException(CosmosStrings.UpdateConflict(id), exception, new[] { entry }),
(int)HttpStatusCode.Conflict =>
- new DbUpdateException(CosmosStrings.UpdateConflict(id), exception, new[] { entry }),
+ new DbUpdateException(CosmosStrings.UpdateConflict(id), exception, new[] { entry }),
_ => Rethrow(exception),
};
}
@@ -409,9 +409,9 @@ private Exception ThrowUpdateException(HttpException exception, IUpdateEntry ent
throw exception.Response.Status switch
{
(int)HttpStatusCode.PreconditionFailed =>
- new DbUpdateConcurrencyException(CosmosStrings.UpdateConflict(id), exception, new[] { entry }),
+ new DbUpdateConcurrencyException(CosmosStrings.UpdateConflict(id), exception, new[] { entry }),
(int)HttpStatusCode.Conflict =>
- new DbUpdateException(CosmosStrings.UpdateConflict(id), exception, new[] { entry }),
+ new DbUpdateException(CosmosStrings.UpdateConflict(id), exception, new[] { entry }),
_ => Rethrow(exception),
};
}
@@ -419,7 +419,7 @@ private Exception ThrowUpdateException(HttpException exception, IUpdateEntry ent
private static Exception Rethrow(Exception ex)
{
// Re-throw an exception, preserving the original stack and details, without being in the original "catch" block.
- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(ex).Throw();
+ ExceptionDispatchInfo.Capture(ex).Throw();
return ex;
}
}
diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategy.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategy.cs
index ac58c510e2d..c8d19ca68d4 100644
--- a/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategy.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategy.cs
@@ -118,7 +118,7 @@ protected override bool ShouldRetryOn(Exception exception)
static bool IsTransient(int status)
=> status == (int)HttpStatusCode.ServiceUnavailable
- || status == (int)HttpStatusCode.TooManyRequests;
+ || status == (int)HttpStatusCode.TooManyRequests;
}
///
@@ -133,7 +133,7 @@ static bool IsTransient(int status)
return baseDelay == null
? null
: CallOnWrappedException(lastException, GetDelayFromException)
- ?? baseDelay;
+ ?? baseDelay;
}
private static TimeSpan? GetDelayFromException(Exception exception)
diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategyFactory.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategyFactory.cs
index 1447372a48a..b8f6dd6da78 100644
--- a/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategyFactory.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategyFactory.cs
@@ -41,7 +41,7 @@ public CosmosExecutionStrategyFactory([NotNull] ExecutionStrategyDependencies de
Dependencies = dependencies;
_createExecutionStrategy = dependencies.Options?.FindExtension()?.ExecutionStrategyFactory
- ?? CreateDefaultStrategy;
+ ?? CreateDefaultStrategy;
}
///
@@ -67,6 +67,7 @@ protected virtual IExecutionStrategy CreateDefaultStrategy([NotNull] ExecutionSt
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual IExecutionStrategy Create() => _createExecutionStrategy(Dependencies);
+ public virtual IExecutionStrategy Create()
+ => _createExecutionStrategy(Dependencies);
}
}
diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosTransactionManager.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosTransactionManager.cs
index 79784f94a5c..d6162c56156 100644
--- a/src/EFCore.Cosmos/Storage/Internal/CosmosTransactionManager.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/CosmosTransactionManager.cs
@@ -23,7 +23,8 @@ public class CosmosTransactionManager : IDbContextTransactionManager, ITransacti
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual IDbContextTransaction BeginTransaction() => throw new NotSupportedException();
+ public virtual IDbContextTransaction BeginTransaction()
+ => throw new NotSupportedException();
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -41,7 +42,8 @@ public virtual Task BeginTransactionAsync(
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual void CommitTransaction() => throw new NotSupportedException();
+ public virtual void CommitTransaction()
+ => throw new NotSupportedException();
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -58,7 +60,8 @@ public virtual Task CommitTransactionAsync(CancellationToken cancellationToken =
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual void RollbackTransaction() => throw new NotSupportedException();
+ public virtual void RollbackTransaction()
+ => throw new NotSupportedException();
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -75,7 +78,8 @@ public virtual Task RollbackTransactionAsync(CancellationToken cancellationToken
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual IDbContextTransaction CurrentTransaction => null;
+ public virtual IDbContextTransaction CurrentTransaction
+ => null;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -83,7 +87,8 @@ public virtual Task RollbackTransactionAsync(CancellationToken cancellationToken
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual Transaction EnlistedTransaction => null;
+ public virtual Transaction EnlistedTransaction
+ => null;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -91,7 +96,8 @@ public virtual Task RollbackTransactionAsync(CancellationToken cancellationToken
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual void EnlistTransaction(Transaction transaction) => throw new NotSupportedException();
+ public virtual void EnlistTransaction(Transaction transaction)
+ => throw new NotSupportedException();
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosTypeMappingSource.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosTypeMappingSource.cs
index 07fa2bada71..373b9e748f5 100644
--- a/src/EFCore.Cosmos/Storage/Internal/CosmosTypeMappingSource.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/CosmosTypeMappingSource.cs
@@ -3,13 +3,9 @@
using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Storage;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.EntityFrameworkCore.Utilities;
using Newtonsoft.Json.Linq;
@@ -59,7 +55,7 @@ protected override CoreTypeMapping FindMapping(in TypeMappingInfo mappingInfo)
}
if ((clrType.IsValueType
- && !clrType.IsEnum)
+ && !clrType.IsEnum)
|| clrType == typeof(string))
{
return new CosmosTypeMapping(clrType);
diff --git a/src/EFCore.Cosmos/Storage/Internal/JsonCosmosSerializer.cs b/src/EFCore.Cosmos/Storage/Internal/JsonCosmosSerializer.cs
index 984e594da29..582ee0cfa33 100644
--- a/src/EFCore.Cosmos/Storage/Internal/JsonCosmosSerializer.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/JsonCosmosSerializer.cs
@@ -51,6 +51,7 @@ public override Stream ToStream(T input)
return streamPayload;
}
- private JsonSerializer GetSerializer() => CosmosClientWrapper.Serializer;
+ private JsonSerializer GetSerializer()
+ => CosmosClientWrapper.Serializer;
}
}
diff --git a/src/EFCore.Cosmos/Storage/Internal/SingletonCosmosClientWrapper.cs b/src/EFCore.Cosmos/Storage/Internal/SingletonCosmosClientWrapper.cs
index 9a7a7689cb0..800d4fd0a18 100644
--- a/src/EFCore.Cosmos/Storage/Internal/SingletonCosmosClientWrapper.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/SingletonCosmosClientWrapper.cs
@@ -44,11 +44,7 @@ public SingletonCosmosClientWrapper([NotNull] ICosmosSingletonOptions options)
_endpoint = options.AccountEndpoint;
_key = options.AccountKey;
_connectionString = options.ConnectionString;
- var configuration = new CosmosClientOptions
- {
- ApplicationName = _userAgent,
- Serializer = new JsonCosmosSerializer()
- };
+ var configuration = new CosmosClientOptions { ApplicationName = _userAgent, Serializer = new JsonCosmosSerializer() };
if (options.Region != null)
{
@@ -109,9 +105,10 @@ public SingletonCosmosClientWrapper([NotNull] ICosmosSingletonOptions options)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual CosmosClient Client => _client ??= string.IsNullOrEmpty(_connectionString)
- ? new CosmosClient(_endpoint, _key, _options)
- : new CosmosClient(_connectionString, _options);
+ public virtual CosmosClient Client
+ => _client ??= string.IsNullOrEmpty(_connectionString)
+ ? new CosmosClient(_endpoint, _key, _options)
+ : new CosmosClient(_connectionString, _options);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs b/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs
index dc67059e76c..8bbc830ea0f 100644
--- a/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs
+++ b/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs
@@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
using System.Collections;
using System.Linq;
using JetBrains.Annotations;
@@ -305,8 +304,9 @@ public virtual JObject UpdateDocument([NotNull] JObject document, [NotNull] IUpd
}
private IProperty GetOrdinalKeyProperty(IEntityType entityType)
- => entityType.FindPrimaryKey().Properties.FirstOrDefault(p =>
- p.GetJsonPropertyName().Length == 0 && p.IsOrdinalKeyProperty());
+ => entityType.FindPrimaryKey().Properties.FirstOrDefault(
+ p =>
+ p.GetJsonPropertyName().Length == 0 && p.IsOrdinalKeyProperty());
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.Cosmos/ValueGeneration/Internal/IdValueGenerator.cs b/src/EFCore.Cosmos/ValueGeneration/Internal/IdValueGenerator.cs
index 949c25512da..deec6e19c2a 100644
--- a/src/EFCore.Cosmos/ValueGeneration/Internal/IdValueGenerator.cs
+++ b/src/EFCore.Cosmos/ValueGeneration/Internal/IdValueGenerator.cs
@@ -23,7 +23,8 @@ public class IdValueGenerator : ValueGenerator
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override bool GeneratesTemporaryValues => false;
+ public override bool GeneratesTemporaryValues
+ => false;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.InMemory/Diagnostics/InMemoryEventId.cs b/src/EFCore.InMemory/Diagnostics/InMemoryEventId.cs
index f61d82d2bfc..376e0d32704 100644
--- a/src/EFCore.InMemory/Diagnostics/InMemoryEventId.cs
+++ b/src/EFCore.InMemory/Diagnostics/InMemoryEventId.cs
@@ -31,7 +31,9 @@ private enum Id
}
private static readonly string _transactionPrefix = DbLoggerCategory.Database.Transaction.Name + ".";
- private static EventId MakeTransactionId(Id id) => new EventId((int)id, _transactionPrefix + id);
+
+ private static EventId MakeTransactionId(Id id)
+ => new EventId((int)id, _transactionPrefix + id);
///
///
@@ -47,7 +49,9 @@ private enum Id
public static readonly EventId TransactionIgnoredWarning = MakeTransactionId(Id.TransactionIgnoredWarning);
private static readonly string _updatePrefix = DbLoggerCategory.Update.Name + ".";
- private static EventId MakeUpdateId(Id id) => new EventId((int)id, _updatePrefix + id);
+
+ private static EventId MakeUpdateId(Id id)
+ => new EventId((int)id, _updatePrefix + id);
///
///
diff --git a/src/EFCore.InMemory/Infrastructure/InMemoryDbContextOptionsBuilder.cs b/src/EFCore.InMemory/Infrastructure/InMemoryDbContextOptionsBuilder.cs
index 7f44af43fb1..43e931a9650 100644
--- a/src/EFCore.InMemory/Infrastructure/InMemoryDbContextOptionsBuilder.cs
+++ b/src/EFCore.InMemory/Infrastructure/InMemoryDbContextOptionsBuilder.cs
@@ -44,22 +44,25 @@ public InMemoryDbContextOptionsBuilder([NotNull] DbContextOptionsBuilder options
///
/// A string that represents the current object.
[EditorBrowsable(EditorBrowsableState.Never)]
- public override string ToString() => base.ToString();
+ public override string ToString()
+ => base.ToString();
///
/// Determines whether the specified object is equal to the current object.
///
/// The object to compare with the current object.
- /// if the specified object is equal to the current object; otherwise, .
+ /// if the specified object is equal to the current object; otherwise, .
[EditorBrowsable(EditorBrowsableState.Never)]
- public override bool Equals(object obj) => base.Equals(obj);
+ public override bool Equals(object obj)
+ => base.Equals(obj);
///
/// Serves as the default hash function.
///
/// A hash code for the current object.
[EditorBrowsable(EditorBrowsableState.Never)]
- public override int GetHashCode() => base.GetHashCode();
+ public override int GetHashCode()
+ => base.GetHashCode();
#endregion
}
diff --git a/src/EFCore.InMemory/Infrastructure/Internal/InMemoryOptionsExtension.cs b/src/EFCore.InMemory/Infrastructure/Internal/InMemoryOptionsExtension.cs
index eb1b2ec3575..aefcc26f1ae 100644
--- a/src/EFCore.InMemory/Infrastructure/Internal/InMemoryOptionsExtension.cs
+++ b/src/EFCore.InMemory/Infrastructure/Internal/InMemoryOptionsExtension.cs
@@ -60,7 +60,8 @@ public virtual DbContextOptionsExtensionInfo Info
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- protected virtual InMemoryOptionsExtension Clone() => new InMemoryOptionsExtension(this);
+ protected virtual InMemoryOptionsExtension Clone()
+ => new InMemoryOptionsExtension(this);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -68,7 +69,8 @@ public virtual DbContextOptionsExtensionInfo Info
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual string StoreName => _storeName;
+ public virtual string StoreName
+ => _storeName;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -91,7 +93,8 @@ public virtual InMemoryOptionsExtension WithStoreName([NotNull] string storeName
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual InMemoryDatabaseRoot DatabaseRoot => _databaseRoot;
+ public virtual InMemoryDatabaseRoot DatabaseRoot
+ => _databaseRoot;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -139,7 +142,8 @@ public ExtensionInfo(IDbContextOptionsExtension extension)
private new InMemoryOptionsExtension Extension
=> (InMemoryOptionsExtension)base.Extension;
- public override bool IsDatabaseProvider => true;
+ public override bool IsDatabaseProvider
+ => true;
public override string LogFragment
{
@@ -158,7 +162,8 @@ public override string LogFragment
}
}
- public override long GetServiceProviderHashCode() => Extension._databaseRoot?.GetHashCode() ?? 0L;
+ public override long GetServiceProviderHashCode()
+ => Extension._databaseRoot?.GetHashCode() ?? 0L;
public override void PopulateDebugInfo(IDictionary debugInfo)
=> debugInfo["InMemoryDatabase:DatabaseRoot"]
diff --git a/src/EFCore.InMemory/Internal/InMemoryModelValidator.cs b/src/EFCore.InMemory/Internal/InMemoryModelValidator.cs
index 0c319f941f0..6111fa529f7 100644
--- a/src/EFCore.InMemory/Internal/InMemoryModelValidator.cs
+++ b/src/EFCore.InMemory/Internal/InMemoryModelValidator.cs
@@ -48,7 +48,8 @@ public override void Validate(IModel model, IDiagnosticsLogger The model to validate.
/// The logger to use.
protected virtual void ValidateDefiningQuery(
- [NotNull] IModel model, [NotNull] IDiagnosticsLogger logger)
+ [NotNull] IModel model,
+ [NotNull] IDiagnosticsLogger logger)
{
Check.NotNull(model, nameof(model));
diff --git a/src/EFCore.InMemory/Metadata/Conventions/DefiningQueryRewritingConvention.cs b/src/EFCore.InMemory/Metadata/Conventions/DefiningQueryRewritingConvention.cs
index a7ed83a164b..9b8593008c8 100644
--- a/src/EFCore.InMemory/Metadata/Conventions/DefiningQueryRewritingConvention.cs
+++ b/src/EFCore.InMemory/Metadata/Conventions/DefiningQueryRewritingConvention.cs
@@ -10,7 +10,8 @@
namespace Microsoft.EntityFrameworkCore.Metadata.Conventions
{
///
- /// Convention that converts accesses of inside query filters and defining queries into .
+ /// Convention that converts accesses of inside query filters and defining queries into
+ /// .
/// This makes them consistent with how DbSet accesses in the actual queries are represented, which allows for easier processing in the
/// query pipeline.
///
diff --git a/src/EFCore.InMemory/Query/Internal/AnonymousObject.cs b/src/EFCore.InMemory/Query/Internal/AnonymousObject.cs
index f9255713d27..091fbae58b2 100644
--- a/src/EFCore.InMemory/Query/Internal/AnonymousObject.cs
+++ b/src/EFCore.InMemory/Query/Internal/AnonymousObject.cs
@@ -36,7 +36,8 @@ public static readonly ConstructorInfo AnonymousObjectCtor
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
[UsedImplicitly]
- public AnonymousObject([NotNull] object[] values) => _values = values;
+ public AnonymousObject([NotNull] object[] values)
+ => _values = values;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -44,7 +45,8 @@ public static readonly ConstructorInfo AnonymousObjectCtor
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public static bool operator ==(AnonymousObject x, AnonymousObject y) => x.Equals(y);
+ public static bool operator ==(AnonymousObject x, AnonymousObject y)
+ => x.Equals(y);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -52,7 +54,8 @@ public static readonly ConstructorInfo AnonymousObjectCtor
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public static bool operator !=(AnonymousObject x, AnonymousObject y) => !x.Equals(y);
+ public static bool operator !=(AnonymousObject x, AnonymousObject y)
+ => !x.Equals(y);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.InMemory/Query/Internal/EntityProjectionExpression.cs b/src/EFCore.InMemory/Query/Internal/EntityProjectionExpression.cs
index ec7dbd62f20..aac4e0f8d90 100644
--- a/src/EFCore.InMemory/Query/Internal/EntityProjectionExpression.cs
+++ b/src/EFCore.InMemory/Query/Internal/EntityProjectionExpression.cs
@@ -6,7 +6,6 @@
using System.Linq;
using System.Linq.Expressions;
using JetBrains.Annotations;
-using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.InMemory.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query;
@@ -34,7 +33,8 @@ private readonly IDictionary _navigationExp
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public EntityProjectionExpression(
- [NotNull] IEntityType entityType, [NotNull] IDictionary readExpressionMap)
+ [NotNull] IEntityType entityType,
+ [NotNull] IDictionary readExpressionMap)
{
EntityType = entityType;
_readExpressionMap = readExpressionMap;
@@ -47,20 +47,24 @@ public EntityProjectionExpression(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual IEntityType EntityType { get; }
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override Type Type => EntityType.ClrType;
+ public override Type Type
+ => EntityType.ClrType;
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -72,8 +76,9 @@ public virtual EntityProjectionExpression UpdateEntityType([NotNull] IEntityType
{
if (!derivedType.GetAllBaseTypes().Contains(EntityType))
{
- throw new InvalidOperationException(InMemoryStrings.InvalidDerivedTypeInEntityProjection(
- derivedType.DisplayName(), EntityType.DisplayName()));
+ throw new InvalidOperationException(
+ InMemoryStrings.InvalidDerivedTypeInEntityProjection(
+ derivedType.DisplayName(), EntityType.DisplayName()));
}
var readExpressionMap = new Dictionary();
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs
index f9b00124b50..bcee5961bf8 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs
@@ -35,14 +35,19 @@ public class InMemoryExpressionTranslatingExpressionVisitor : ExpressionVisitor
private static readonly MethodInfo _parameterValueExtractor =
typeof(InMemoryExpressionTranslatingExpressionVisitor).GetTypeInfo().GetDeclaredMethod(nameof(ParameterValueExtractor));
+
private static readonly MethodInfo _parameterListValueExtractor =
typeof(InMemoryExpressionTranslatingExpressionVisitor).GetTypeInfo().GetDeclaredMethod(nameof(ParameterListValueExtractor));
+
private static readonly MethodInfo _getParameterValueMethodInfo =
typeof(InMemoryExpressionTranslatingExpressionVisitor).GetTypeInfo().GetDeclaredMethod(nameof(GetParameterValue));
+
private static readonly MethodInfo _likeMethodInfo = typeof(DbFunctionsExtensions).GetRuntimeMethod(
- nameof(DbFunctionsExtensions.Like), new[] { typeof(DbFunctions), typeof(string), typeof(string) });
+ nameof(DbFunctionsExtensions.Like), new[] { typeof(DbFunctions), typeof(string), typeof(string) });
+
private static readonly MethodInfo _likeMethodInfoWithEscape = typeof(DbFunctionsExtensions).GetRuntimeMethod(
- nameof(DbFunctionsExtensions.Like), new[] { typeof(DbFunctions), typeof(string), typeof(string), typeof(string) });
+ nameof(DbFunctionsExtensions.Like), new[] { typeof(DbFunctions), typeof(string), typeof(string), typeof(string) });
+
private static readonly MethodInfo _inMemoryLikeMethodInfo =
typeof(InMemoryExpressionTranslatingExpressionVisitor).GetTypeInfo().GetDeclaredMethod(nameof(InMemoryLike));
@@ -54,6 +59,7 @@ private static readonly char[] _regexSpecialChars
private static readonly string _defaultEscapeRegexCharsPattern = BuildEscapeRegexCharsPattern(_regexSpecialChars);
private static readonly TimeSpan _regexTimeout = TimeSpan.FromMilliseconds(value: 1000.0);
+
private static string BuildEscapeRegexCharsPattern(IEnumerable regexSpecialChars)
=> string.Join("|", regexSpecialChars.Select(c => @"\" + c));
@@ -157,7 +163,7 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression)
}
if ((binaryExpression.NodeType == ExpressionType.Equal
- || binaryExpression.NodeType == ExpressionType.NotEqual)
+ || binaryExpression.NodeType == ExpressionType.NotEqual)
// Visited expression could be null, We need to pass MemberInitExpression
&& TryRewriteEntityEquality(
binaryExpression.NodeType, newLeft ?? binaryExpression.Left, newRight ?? binaryExpression.Right, out var result))
@@ -264,7 +270,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
case ProjectionBindingExpression projectionBindingExpression:
return projectionBindingExpression.ProjectionMember != null
? ((InMemoryQueryExpression)projectionBindingExpression.QueryExpression)
- .GetMappedProjection(projectionBindingExpression.ProjectionMember)
+ .GetMappedProjection(projectionBindingExpression.ProjectionMember)
: null;
case InMemoryGroupByShaperExpression inMemoryGroupByShaperExpression:
@@ -284,21 +290,26 @@ protected override Expression VisitExtension(Expression extensionExpression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- protected override Expression VisitInvocation(InvocationExpression invocationExpression) => null;
+ protected override Expression VisitInvocation(InvocationExpression invocationExpression)
+ => null;
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- protected override Expression VisitLambda(Expression lambdaExpression) => null;
+ protected override Expression VisitLambda(Expression lambdaExpression)
+ => null;
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- protected override Expression VisitListInit(ListInitExpression listInitExpression) => null;
+ protected override Expression VisitListInit(ListInitExpression listInitExpression)
+ => null;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -417,7 +428,8 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
result = expression == null
? null
- : Expression.Call(EnumerableMethods.GetAverageWithoutSelector(expression.Type.TryGetSequenceType()), expression);
+ : Expression.Call(
+ EnumerableMethods.GetAverageWithoutSelector(expression.Type.TryGetSequenceType()), expression);
break;
}
@@ -551,7 +563,8 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
result = expression == null
? null
- : Expression.Call(EnumerableMethods.GetSumWithoutSelector(expression.Type.TryGetSequenceType()), expression);
+ : Expression.Call(
+ EnumerableMethods.GetSumWithoutSelector(expression.Type.TryGetSequenceType()), expression);
break;
}
@@ -605,7 +618,9 @@ Expression ApplySelect(GroupingElementExpression groupingElement)
return result;
}
- static GroupingElementExpression ApplySelector(GroupingElementExpression groupingElement, LambdaExpression lambdaExpression)
+ static GroupingElementExpression ApplySelector(
+ GroupingElementExpression groupingElement,
+ LambdaExpression lambdaExpression)
{
var selector = RemapLambda(groupingElement, lambdaExpression);
@@ -646,13 +661,14 @@ static Expression RemapLambda(GroupingElementExpression groupingElement, LambdaE
}
if (!(innerExpression is ProjectionBindingExpression projectionBindingExpression
- && (convertedType == null
+ && (convertedType == null
|| convertedType.MakeNullable() == innerExpression.Type)))
{
return null;
}
- return ProcessSingleResultScalar(subquery.ServerQueryExpression,
+ return ProcessSingleResultScalar(
+ subquery.ServerQueryExpression,
subquery.GetMappedProjection(projectionBindingExpression.ProjectionMember),
subquery.CurrentParameter,
methodCallExpression.Type);
@@ -690,10 +706,11 @@ static Expression RemapLambda(GroupingElementExpression groupingElement, LambdaE
var left = Visit(methodCallExpression.Object);
var right = Visit(methodCallExpression.Arguments[0]);
- if (TryRewriteEntityEquality(ExpressionType.Equal,
- left ?? methodCallExpression.Object,
- right ?? methodCallExpression.Arguments[0],
- out var result))
+ if (TryRewriteEntityEquality(
+ ExpressionType.Equal,
+ left ?? methodCallExpression.Object,
+ right ?? methodCallExpression.Arguments[0],
+ out var result))
{
return result;
}
@@ -714,14 +731,16 @@ static Expression RemapLambda(GroupingElementExpression groupingElement, LambdaE
if (methodCallExpression.Arguments[0].Type == typeof(object[])
&& methodCallExpression.Arguments[0] is NewArrayExpression)
{
- return Visit(ConvertObjectArrayEqualityComparison(
- methodCallExpression.Arguments[0], methodCallExpression.Arguments[1]));
+ return Visit(
+ ConvertObjectArrayEqualityComparison(
+ methodCallExpression.Arguments[0], methodCallExpression.Arguments[1]));
}
var left = Visit(methodCallExpression.Arguments[0]);
var right = Visit(methodCallExpression.Arguments[1]);
- if (TryRewriteEntityEquality(ExpressionType.Equal,
+ if (TryRewriteEntityEquality(
+ ExpressionType.Equal,
left ?? methodCallExpression.Arguments[0],
right ?? methodCallExpression.Arguments[1],
out var result))
@@ -1099,7 +1118,10 @@ private Expression BindProperty(EntityReferenceExpression entityReferenceExpress
}
private static Expression ProcessSingleResultScalar(
- Expression serverQuery, Expression readValueExpression, Expression valueBufferParameter, Type type)
+ Expression serverQuery,
+ Expression readValueExpression,
+ Expression valueBufferParameter,
+ Type type)
{
var singleResult = ((LambdaExpression)((NewExpression)serverQuery).Arguments[0]).Body;
if (readValueExpression is UnaryExpression unaryExpression
@@ -1195,7 +1217,8 @@ private bool TryRewriteContainsEntity(Expression source, Expression item, out Ex
{
case ConstantExpression constantExpression:
var values = (IEnumerable)constantExpression.Value;
- var propertyValueList = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(property.ClrType.MakeNullable()));
+ var propertyValueList =
+ (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(property.ClrType.MakeNullable()));
var propertyGetter = property.GetGetter();
foreach (var value in values)
{
@@ -1206,7 +1229,7 @@ private bool TryRewriteContainsEntity(Expression source, Expression item, out Ex
break;
case MethodCallExpression methodCallExpression
- when methodCallExpression.Method.IsGenericMethod
+ when methodCallExpression.Method.IsGenericMethod
&& methodCallExpression.Method.GetGenericMethodDefinition() == _getParameterValueMethodInfo:
var parameterName = (string)((ConstantExpression)methodCallExpression.Arguments[1]).Value;
var lambda = Expression.Lambda(
@@ -1219,8 +1242,8 @@ when methodCallExpression.Method.IsGenericMethod
);
var newParameterName =
- $"{_runtimeParameterPrefix}" +
- $"{parameterName.Substring(QueryCompilationContext.QueryParameterPrefix.Length)}_{property.Name}";
+ $"{_runtimeParameterPrefix}"
+ + $"{parameterName.Substring(QueryCompilationContext.QueryParameterPrefix.Length)}_{property.Name}";
rewrittenSource = _queryCompilationContext.RegisterRuntimeParameter(newParameterName, lambda);
break;
@@ -1229,10 +1252,11 @@ when methodCallExpression.Method.IsGenericMethod
return false;
}
- result = Visit(Expression.Call(
- EnumerableMethods.Contains.MakeGenericMethod(property.ClrType.MakeNullable()),
- rewrittenSource,
- CreatePropertyAccessExpression(item, property)));
+ result = Visit(
+ Expression.Call(
+ EnumerableMethods.Contains.MakeGenericMethod(property.ClrType.MakeNullable()),
+ rewrittenSource,
+ CreatePropertyAccessExpression(item, property)));
return true;
}
@@ -1260,10 +1284,13 @@ private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left,
throw new InvalidOperationException(CoreStrings.EntityEqualityOnKeylessEntityNotSupported(entityType1.DisplayName()));
}
- result = Visit(primaryKeyProperties1.Select(p =>
- Expression.MakeBinary(
- nodeType, CreatePropertyAccessExpression(nonNullEntityReference, p), Expression.Constant(null, p.ClrType.MakeNullable())))
- .Aggregate((l, r) => nodeType == ExpressionType.Equal ? Expression.OrElse(l, r) : Expression.AndAlso(l, r)));
+ result = Visit(
+ primaryKeyProperties1.Select(
+ p =>
+ Expression.MakeBinary(
+ nodeType, CreatePropertyAccessExpression(nonNullEntityReference, p),
+ Expression.Constant(null, p.ClrType.MakeNullable())))
+ .Aggregate((l, r) => nodeType == ExpressionType.Equal ? Expression.OrElse(l, r) : Expression.AndAlso(l, r)));
return true;
}
@@ -1296,11 +1323,13 @@ private bool TryRewriteEntityEquality(ExpressionType nodeType, Expression left,
CoreStrings.EntityEqualitySubqueryWithCompositeKeyNotSupported(entityType.DisplayName()));
}
- result = Visit(primaryKeyProperties.Select(p =>
- Expression.MakeBinary(
- nodeType,
- CreatePropertyAccessExpression(left, p),
- CreatePropertyAccessExpression(right, p)))
+ result = Visit(
+ primaryKeyProperties.Select(
+ p =>
+ Expression.MakeBinary(
+ nodeType,
+ CreatePropertyAccessExpression(left, p),
+ CreatePropertyAccessExpression(right, p)))
.Aggregate((l, r) => Expression.AndAlso(l, r)));
return true;
@@ -1315,7 +1344,7 @@ private Expression CreatePropertyAccessExpression(Expression target, IProperty p
property.GetGetter().GetClrValue(constantExpression.Value), property.ClrType.MakeNullable());
case MethodCallExpression methodCallExpression
- when methodCallExpression.Method.IsGenericMethod
+ when methodCallExpression.Method.IsGenericMethod
&& methodCallExpression.Method.GetGenericMethodDefinition() == _getParameterValueMethodInfo:
var parameterName = (string)((ConstantExpression)methodCallExpression.Arguments[1]).Value;
var lambda = Expression.Lambda(
@@ -1327,24 +1356,24 @@ when methodCallExpression.Method.IsGenericMethod
QueryCompilationContext.QueryContextParameter);
var newParameterName =
- $"{_runtimeParameterPrefix}" +
- $"{parameterName.Substring(QueryCompilationContext.QueryParameterPrefix.Length)}_{property.Name}";
+ $"{_runtimeParameterPrefix}"
+ + $"{parameterName.Substring(QueryCompilationContext.QueryParameterPrefix.Length)}_{property.Name}";
return _queryCompilationContext.RegisterRuntimeParameter(newParameterName, lambda);
case MemberInitExpression memberInitExpression
- when memberInitExpression.Bindings.SingleOrDefault(
- mb => mb.Member.Name == property.Name) is MemberAssignment memberAssignment:
+ when memberInitExpression.Bindings.SingleOrDefault(
+ mb => mb.Member.Name == property.Name) is MemberAssignment memberAssignment:
return memberAssignment.Expression.Type.IsNullableType()
? memberAssignment.Expression
: Expression.Convert(memberAssignment.Expression, property.ClrType.MakeNullable());
case NewExpression newExpression
- when CanEvaluate(newExpression):
+ when CanEvaluate(newExpression):
return CreatePropertyAccessExpression(GetValue(newExpression), property);
case MemberInitExpression memberInitExpression
- when CanEvaluate(memberInitExpression):
+ when CanEvaluate(memberInitExpression):
return CreatePropertyAccessExpression(GetValue(memberInitExpression), property);
default:
@@ -1359,7 +1388,9 @@ private static T ParameterValueExtractor(QueryContext context, string basePar
}
private static List ParameterListValueExtractor(
- QueryContext context, string baseParameterName, IProperty property)
+ QueryContext context,
+ string baseParameterName,
+ IProperty property)
{
if (!(context.ParameterValues[baseParameterName] is IEnumerable baseListParameter))
{
@@ -1425,8 +1456,8 @@ static Expression RemoveObjectConvert(Expression expression)
=> expression is UnaryExpression unaryExpression
&& expression.Type == typeof(object)
&& expression.NodeType == ExpressionType.Convert
- ? unaryExpression.Operand
- : expression;
+ ? unaryExpression.Operand
+ : expression;
}
private static bool IsNullConstantExpression(Expression expression)
@@ -1575,8 +1606,11 @@ private EntityReferenceExpression(EntityReferenceExpression entityReferenceExpre
public ShapedQueryExpression SubqueryEntity { get; }
public IEntityType EntityType { get; }
- public override Type Type => EntityType.ClrType;
- public override ExpressionType NodeType => ExpressionType.Extension;
+ public override Type Type
+ => EntityType.ClrType;
+
+ public override ExpressionType NodeType
+ => ExpressionType.Extension;
public Expression Convert(Type type)
{
@@ -1600,16 +1634,19 @@ public GroupingElementExpression(Expression source, Expression selector, Paramet
ValueBufferParameter = valueBufferParameter;
Selector = selector;
}
+
public Expression Source { get; private set; }
public bool IsDistinct { get; private set; }
public Expression Selector { get; private set; }
public ParameterExpression ValueBufferParameter { get; }
+
public GroupingElementExpression ApplyDistinct()
{
IsDistinct = true;
return this;
}
+
public GroupingElementExpression ApplySelector(Expression expression)
{
Selector = expression;
@@ -1624,8 +1661,11 @@ public GroupingElementExpression UpdateSource(Expression source)
return this;
}
- public override Type Type => typeof(IEnumerable<>).MakeGenericType(Selector.Type);
- public override ExpressionType NodeType => ExpressionType.Extension;
+ public override Type Type
+ => typeof(IEnumerable<>).MakeGenericType(Selector.Type);
+
+ public override ExpressionType NodeType
+ => ExpressionType.Extension;
}
}
}
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryGroupByShaperExpression.cs b/src/EFCore.InMemory/Query/Internal/InMemoryGroupByShaperExpression.cs
index b5e45bdd6f7..c8b1acf52f4 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryGroupByShaperExpression.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryGroupByShaperExpression.cs
@@ -39,6 +39,7 @@ public InMemoryGroupByShaperExpression(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual ParameterExpression GroupingParameter { get; }
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs
index dcbc3cec828..4ac33316af2 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
-using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
@@ -132,7 +131,7 @@ public override Expression Visit(Expression expression)
&& methodCallExpression.Method.Name == nameof(Enumerable.ToList))
{
var subqueryTranslation = _queryableMethodTranslatingExpressionVisitor.TranslateSubquery(
- methodCallExpression.Arguments[0]);
+ methodCallExpression.Arguments[0]);
if (subqueryTranslation != null)
{
@@ -170,7 +169,7 @@ public override Expression Visit(Expression expression)
return translation == null
? base.Visit(expression)
: new ProjectionBindingExpression(
- _queryExpression, _queryExpression.AddToProjection(translation), expression.Type.MakeNullable());
+ _queryExpression, _queryExpression.AddToProjection(translation), expression.Type.MakeNullable());
}
else
{
@@ -481,10 +480,10 @@ protected override Expression VisitUnary(UnaryExpression unaryExpression)
var operand = Visit(unaryExpression.Operand);
return (unaryExpression.NodeType == ExpressionType.Convert
- || unaryExpression.NodeType == ExpressionType.ConvertChecked)
+ || unaryExpression.NodeType == ExpressionType.ConvertChecked)
&& unaryExpression.Type == operand.Type
- ? operand
- : unaryExpression.Update(MatchTypes(operand, unaryExpression.Operand.Type));
+ ? operand
+ : unaryExpression.Update(MatchTypes(operand, unaryExpression.Operand.Type));
}
// TODO: Debugging
@@ -497,7 +496,9 @@ private void VerifyQueryExpression(ProjectionBindingExpression projectionBinding
}
private CollectionShaperExpression AddCollectionProjection(
- ShapedQueryExpression subquery, INavigationBase navigation, Type elementType)
+ ShapedQueryExpression subquery,
+ INavigationBase navigation,
+ Type elementType)
=> new CollectionShaperExpression(
new ProjectionBindingExpression(
_queryExpression,
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.ResultEnumerable.cs b/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.ResultEnumerable.cs
index a41d40644bf..4f4f92e5610 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.ResultEnumerable.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.ResultEnumerable.cs
@@ -19,9 +19,11 @@ public ResultEnumerable(Func getElement)
_getElement = getElement;
}
- public IEnumerator GetEnumerator() => new ResultEnumerator(_getElement());
+ public IEnumerator GetEnumerator()
+ => new ResultEnumerator(_getElement());
- IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
+ IEnumerator IEnumerable.GetEnumerator()
+ => GetEnumerator();
private sealed class ResultEnumerator : IEnumerator
{
@@ -51,9 +53,11 @@ public void Reset()
_moved = false;
}
- object IEnumerator.Current => Current;
+ object IEnumerator.Current
+ => Current;
- public ValueBuffer Current => !_moved ? ValueBuffer.Empty : _value;
+ public ValueBuffer Current
+ => !_moved ? ValueBuffer.Empty : _value;
void IDisposable.Dispose()
{
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.cs b/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.cs
index 9d14460626f..dd8ea804a6a 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.cs
@@ -47,7 +47,9 @@ private readonly IDictionary
- public virtual IReadOnlyList Projection => _valueBufferSlots;
+ public virtual IReadOnlyList Projection
+ => _valueBufferSlots;
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
@@ -55,27 +57,33 @@ private readonly IDictionary
public virtual Expression ServerQueryExpression { get; private set; }
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual ParameterExpression CurrentParameter => _groupingParameter ?? _valueBufferParameter;
+ public virtual ParameterExpression CurrentParameter
+ => _groupingParameter ?? _valueBufferParameter;
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override Type Type => typeof(IEnumerable);
+ public override Type Type
+ => typeof(IEnumerable);
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -111,7 +119,6 @@ public InMemoryQueryExpression([NotNull] IEntityType entityType)
var entityProjection = new EntityProjectionExpression(entityType, readExpressionMap);
_projectionMapping[new ProjectionMember()] = entityProjection;
-
}
///
@@ -220,7 +227,9 @@ public virtual int AddToProjection([NotNull] Expression expression)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual int AddSubqueryProjection([NotNull] ShapedQueryExpression shapedQueryExpression, [CanBeNull] out Expression innerShaper)
+ public virtual int AddSubqueryProjection(
+ [NotNull] ShapedQueryExpression shapedQueryExpression,
+ [CanBeNull] out Expression innerShaper)
{
var subquery = (InMemoryQueryExpression)shapedQueryExpression.QueryExpression;
subquery.ApplyProjection();
@@ -433,8 +442,8 @@ private static IPropertyBase InferPropertyFromInner(Expression expression)
=> expression is MethodCallExpression methodCallExpression
&& methodCallExpression.Method.IsGenericMethod
&& methodCallExpression.Method.GetGenericMethodDefinition() == ExpressionExtensions.ValueBufferTryReadValueMethod
- ? (IPropertyBase)((ConstantExpression)methodCallExpression.Arguments[2]).Value
- : null;
+ ? (IPropertyBase)((ConstantExpression)methodCallExpression.Arguments[2]).Value
+ : null;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -490,7 +499,9 @@ public virtual void ApplyProjection()
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual InMemoryGroupByShaperExpression ApplyGrouping([NotNull] Expression groupingKey, [NotNull] Expression shaperExpression)
+ public virtual InMemoryGroupByShaperExpression ApplyGrouping(
+ [NotNull] Expression groupingKey,
+ [NotNull] Expression shaperExpression)
{
PushdownIntoSubquery();
@@ -707,7 +718,7 @@ public virtual void AddLeftJoin(
var projectionMapping = new Dictionary();
var replacingVisitor = new ReplacingExpressionVisitor(
new Expression[] { CurrentParameter, innerQueryExpression.CurrentParameter },
- new Expression[] { MakeMemberAccess(outerParameter, outerMemberInfo), innerParameter});
+ new Expression[] { MakeMemberAccess(outerParameter, outerMemberInfo), innerParameter });
var index = 0;
outerMemberInfo = transparentIdentifierType.GetTypeInfo().GetDeclaredField("Outer");
@@ -803,7 +814,9 @@ public virtual void AddLeftJoin(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual void AddSelectMany(
- [NotNull] InMemoryQueryExpression innerQueryExpression, [CanBeNull] Type transparentIdentifierType, bool innerNullable)
+ [NotNull] InMemoryQueryExpression innerQueryExpression,
+ [CanBeNull] Type transparentIdentifierType,
+ bool innerNullable)
{
var outerParameter = Parameter(typeof(ValueBuffer), "outer");
var innerParameter = Parameter(typeof(ValueBuffer), "inner");
@@ -941,7 +954,7 @@ public virtual EntityShaperExpression AddNavigationToWeakEntityType(
var projectionMapping = new Dictionary();
var replacingVisitor = new ReplacingExpressionVisitor(
new Expression[] { CurrentParameter, innerQueryExpression.CurrentParameter },
- new Expression[] { MakeMemberAccess(outerParameter, outerMemberInfo), innerParameter});
+ new Expression[] { MakeMemberAccess(outerParameter, outerMemberInfo), innerParameter });
var index = 0;
EntityProjectionExpression copyEntityProjectionToOuter(EntityProjectionExpression entityProjection)
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryQueryableMethodTranslatingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryQueryableMethodTranslatingExpressionVisitor.cs
index 2096eb16933..63b42f37ff4 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryQueryableMethodTranslatingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryQueryableMethodTranslatingExpressionVisitor.cs
@@ -353,7 +353,9 @@ protected override ShapedQueryExpression TranslateDistinct(ShapedQueryExpression
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateElementAtOrDefault(
- ShapedQueryExpression source, Expression index, bool returnDefault)
+ ShapedQueryExpression source,
+ Expression index,
+ bool returnDefault)
{
Check.NotNull(source, nameof(source));
Check.NotNull(index, nameof(index));
@@ -382,7 +384,10 @@ protected override ShapedQueryExpression TranslateExcept(ShapedQueryExpression s
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateFirstOrDefault(
- ShapedQueryExpression source, LambdaExpression predicate, Type returnType, bool returnDefault)
+ ShapedQueryExpression source,
+ LambdaExpression predicate,
+ Type returnType,
+ bool returnDefault)
{
Check.NotNull(source, nameof(source));
Check.NotNull(returnType, nameof(returnType));
@@ -403,7 +408,10 @@ protected override ShapedQueryExpression TranslateFirstOrDefault(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateGroupBy(
- ShapedQueryExpression source, LambdaExpression keySelector, LambdaExpression elementSelector, LambdaExpression resultSelector)
+ ShapedQueryExpression source,
+ LambdaExpression keySelector,
+ LambdaExpression elementSelector,
+ LambdaExpression resultSelector)
{
Check.NotNull(source, nameof(source));
Check.NotNull(keySelector, nameof(keySelector));
@@ -581,7 +589,10 @@ protected override ShapedQueryExpression TranslateJoin(
}
private (LambdaExpression OuterKeySelector, LambdaExpression InnerKeySelector) ProcessJoinKeySelector(
- ShapedQueryExpression outer, ShapedQueryExpression inner, LambdaExpression outerKeySelector, LambdaExpression innerKeySelector)
+ ShapedQueryExpression outer,
+ ShapedQueryExpression inner,
+ LambdaExpression outerKeySelector,
+ LambdaExpression innerKeySelector)
{
var left = RemapLambdaBody(outer, outerKeySelector);
var right = RemapLambdaBody(inner, innerKeySelector);
@@ -625,9 +636,10 @@ static Expression CreateAnonymousObject(List expressions)
expressions.Select(e => Expression.Convert(e, typeof(object)))));
}
-
private static bool ProcessJoinCondition(
- Expression joinCondition, List leftExpressions, List rightExpressions)
+ Expression joinCondition,
+ List leftExpressions,
+ List rightExpressions)
{
if (joinCondition is BinaryExpression binaryExpression)
{
@@ -681,7 +693,10 @@ static bool IsConvertedToNullable(Expression outer, Expression inner)
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateLastOrDefault(
- ShapedQueryExpression source, LambdaExpression predicate, Type returnType, bool returnDefault)
+ ShapedQueryExpression source,
+ LambdaExpression predicate,
+ Type returnType,
+ bool returnDefault)
{
Check.NotNull(source, nameof(source));
Check.NotNull(returnType, nameof(returnType));
@@ -702,7 +717,10 @@ protected override ShapedQueryExpression TranslateLastOrDefault(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateLeftJoin(
- ShapedQueryExpression outer, ShapedQueryExpression inner, LambdaExpression outerKeySelector, LambdaExpression innerKeySelector,
+ ShapedQueryExpression outer,
+ ShapedQueryExpression inner,
+ LambdaExpression outerKeySelector,
+ LambdaExpression innerKeySelector,
LambdaExpression resultSelector)
{
Check.NotNull(outer, nameof(outer));
@@ -717,7 +735,6 @@ protected override ShapedQueryExpression TranslateLeftJoin(
return null;
}
-
var transparentIdentifierType = TransparentIdentifierFactory.Create(
resultSelector.Parameters[0].Type,
resultSelector.Parameters[1].Type);
@@ -780,7 +797,9 @@ protected override ShapedQueryExpression TranslateLongCount(ShapedQueryExpressio
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateMax(
- ShapedQueryExpression source, LambdaExpression selector, Type resultType)
+ ShapedQueryExpression source,
+ LambdaExpression selector,
+ Type resultType)
{
Check.NotNull(source, nameof(source));
@@ -845,7 +864,7 @@ protected override ShapedQueryExpression TranslateOfType(ShapedQueryExpression s
inMemoryQueryExpression.ReplaceProjectionMapping(
new Dictionary
{
- { projectionMember, entityProjectionExpression.UpdateEntityType(derivedType) }
+ { projectionMember, entityProjectionExpression.UpdateEntityType(derivedType) }
});
return source.UpdateShaperExpression(entityShaperExpression.WithEntityType(derivedType));
@@ -861,7 +880,9 @@ protected override ShapedQueryExpression TranslateOfType(ShapedQueryExpression s
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateOrderBy(
- ShapedQueryExpression source, LambdaExpression keySelector, bool ascending)
+ ShapedQueryExpression source,
+ LambdaExpression keySelector,
+ bool ascending)
{
Check.NotNull(source, nameof(source));
Check.NotNull(keySelector, nameof(keySelector));
@@ -942,7 +963,9 @@ protected override ShapedQueryExpression TranslateSelect(ShapedQueryExpression s
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateSelectMany(
- ShapedQueryExpression source, LambdaExpression collectionSelector, LambdaExpression resultSelector)
+ ShapedQueryExpression source,
+ LambdaExpression collectionSelector,
+ LambdaExpression resultSelector)
{
Check.NotNull(source, nameof(source));
Check.NotNull(collectionSelector, nameof(collectionSelector));
@@ -1028,7 +1051,10 @@ protected override ShapedQueryExpression TranslateSelectMany(ShapedQueryExpressi
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
protected override ShapedQueryExpression TranslateSingleOrDefault(
- ShapedQueryExpression source, LambdaExpression predicate, Type returnType, bool returnDefault)
+ ShapedQueryExpression source,
+ LambdaExpression predicate,
+ Type returnType,
+ bool returnDefault)
{
Check.NotNull(source, nameof(source));
Check.NotNull(returnType, nameof(returnType));
@@ -1263,7 +1289,8 @@ public WeakEntityExpandingExpressionVisitor(InMemoryExpressionTranslatingExpress
_expressionTranslator = expressionTranslator;
}
- public string TranslationErrorDetails => _expressionTranslator.TranslationErrorDetails;
+ public string TranslationErrorDetails
+ => _expressionTranslator.TranslationErrorDetails;
public Expression Expand(InMemoryQueryExpression queryExpression, Expression lambdaBody)
{
@@ -1434,7 +1461,10 @@ ProjectionBindingExpression projectionBindingExpression
}
private ShapedQueryExpression TranslateScalarAggregate(
- ShapedQueryExpression source, LambdaExpression selector, string methodName, Type returnType)
+ ShapedQueryExpression source,
+ LambdaExpression selector,
+ string methodName,
+ Type returnType)
{
var inMemoryQueryExpression = (InMemoryQueryExpression)source.QueryExpression;
@@ -1472,7 +1502,10 @@ MethodInfo GetMethod()
}
private ShapedQueryExpression TranslateSingleResultOperator(
- ShapedQueryExpression source, LambdaExpression predicate, Type returnType, MethodInfo method)
+ ShapedQueryExpression source,
+ LambdaExpression predicate,
+ Type returnType,
+ MethodInfo method)
{
var inMemoryQueryExpression = (InMemoryQueryExpression)source.QueryExpression;
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.InMemoryProjectionBindingRemovingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.InMemoryProjectionBindingRemovingExpressionVisitor.cs
index fce4c902944..75440650364 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.InMemoryProjectionBindingRemovingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.InMemoryProjectionBindingRemovingExpressionVisitor.cs
@@ -70,7 +70,8 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
_materializationContextBindings[
(ParameterExpression)((MethodCallExpression)methodCallExpression.Arguments[0]).Object];
- Check.DebugAssert(property != null || methodCallExpression.Type.IsNullableType(), "Must read nullable value without property");
+ Check.DebugAssert(
+ property != null || methodCallExpression.Type.IsNullableType(), "Must read nullable value without property");
return Expression.Call(
methodCallExpression.Method,
@@ -93,7 +94,9 @@ protected override Expression VisitExtension(Expression extensionExpression)
var valueBuffer = queryExpression.CurrentParameter;
var property = InferPropertyFromInner(queryExpression.Projection[projectionIndex]);
- Check.DebugAssert(property != null || projectionBindingExpression.Type.IsNullableType()
+ Check.DebugAssert(
+ property != null
+ || projectionBindingExpression.Type.IsNullableType()
|| projectionBindingExpression.Type == typeof(ValueBuffer), "Must read nullable value without property");
return valueBuffer.CreateValueBufferReadValueExpression(projectionBindingExpression.Type, projectionIndex, property);
@@ -115,7 +118,8 @@ private IPropertyBase InferPropertyFromInner(Expression expression)
}
private object GetProjectionIndex(
- InMemoryQueryExpression queryExpression, ProjectionBindingExpression projectionBindingExpression)
+ InMemoryQueryExpression queryExpression,
+ ProjectionBindingExpression projectionBindingExpression)
{
return projectionBindingExpression.ProjectionMember != null
? ((ConstantExpression)queryExpression.GetMappedProjection(projectionBindingExpression.ProjectionMember)).Value
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
index 35f00489dab..216ac490a36 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
@@ -50,11 +50,14 @@ public QueryingEnumerable(
public IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default)
=> new Enumerator(this, cancellationToken);
- public IEnumerator GetEnumerator() => new Enumerator(this);
+ public IEnumerator GetEnumerator()
+ => new Enumerator(this);
- IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
+ IEnumerator IEnumerable.GetEnumerator()
+ => GetEnumerator();
- public string ToQueryString() => InMemoryStrings.NoQueryStrings;
+ public string ToQueryString()
+ => InMemoryStrings.NoQueryStrings;
private sealed class Enumerator : IEnumerator, IAsyncEnumerator
{
@@ -80,7 +83,8 @@ public Enumerator(QueryingEnumerable queryingEnumerable, CancellationToken ca
public T Current { get; private set; }
- object IEnumerator.Current => Current;
+ object IEnumerator.Current
+ => Current;
public bool MoveNext()
{
@@ -151,7 +155,8 @@ public ValueTask DisposeAsync()
return enumerator.DisposeAsyncIfAvailable();
}
- public void Reset() => throw new NotImplementedException();
+ public void Reset()
+ => throw new NotImplementedException();
}
}
}
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.cs
index 53972f05fd3..c55301e6ea5 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.cs
@@ -6,7 +6,6 @@
using System.Linq.Expressions;
using System.Reflection;
using JetBrains.Annotations;
-using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Storage;
@@ -91,7 +90,8 @@ protected override Expression VisitShapedQuery(ShapedQueryExpression shapedQuery
innerEnumerable,
Expression.Constant(shaperLambda.Compile()),
Expression.Constant(_contextType),
- Expression.Constant(QueryCompilationContext.QueryTrackingBehavior == QueryTrackingBehavior.NoTrackingWithIdentityResolution));
+ Expression.Constant(
+ QueryCompilationContext.QueryTrackingBehavior == QueryTrackingBehavior.NoTrackingWithIdentityResolution));
}
private static readonly MethodInfo _tableMethodInfo
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryExpressionVisitorFactory.cs b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryExpressionVisitorFactory.cs
index 89eecd3b95b..f7ac72cc406 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryExpressionVisitorFactory.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryExpressionVisitorFactory.cs
@@ -23,7 +23,8 @@ public class InMemoryShapedQueryCompilingExpressionVisitorFactory : IShapedQuery
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public InMemoryShapedQueryCompilingExpressionVisitorFactory([NotNull] ShapedQueryCompilingExpressionVisitorDependencies dependencies)
+ public InMemoryShapedQueryCompilingExpressionVisitorFactory(
+ [NotNull] ShapedQueryCompilingExpressionVisitorDependencies dependencies)
{
_dependencies = dependencies;
}
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryTableExpression.cs b/src/EFCore.InMemory/Query/Internal/InMemoryTableExpression.cs
index 1be1b897e9a..d963b5adb6e 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryTableExpression.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryTableExpression.cs
@@ -37,7 +37,8 @@ public InMemoryTableExpression([NotNull] IEntityType entityType)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public override Type Type => typeof(IEnumerable);
+ public override Type Type
+ => typeof(IEnumerable);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -53,7 +54,8 @@ public InMemoryTableExpression([NotNull] IEntityType entityType)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.InMemory/Query/Internal/ShaperExpressionProcessingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/ShaperExpressionProcessingExpressionVisitor.cs
index d87e92ab261..446ea91d876 100644
--- a/src/EFCore.InMemory/Query/Internal/ShaperExpressionProcessingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/ShaperExpressionProcessingExpressionVisitor.cs
@@ -31,7 +31,8 @@ public class ShaperExpressionProcessingExpressionVisitor : ExpressionVisitor
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public ShaperExpressionProcessingExpressionVisitor(
- [CanBeNull] InMemoryQueryExpression queryExpression, [NotNull] ParameterExpression valueBufferParameter)
+ [CanBeNull] InMemoryQueryExpression queryExpression,
+ [NotNull] ParameterExpression valueBufferParameter)
{
_queryExpression = queryExpression;
_valueBufferParameter = valueBufferParameter;
diff --git a/src/EFCore.InMemory/Query/Internal/SingleResultShaperExpression.cs b/src/EFCore.InMemory/Query/Internal/SingleResultShaperExpression.cs
index acd6bbc7e32..43c1e236860 100644
--- a/src/EFCore.InMemory/Query/Internal/SingleResultShaperExpression.cs
+++ b/src/EFCore.InMemory/Query/Internal/SingleResultShaperExpression.cs
@@ -66,7 +66,9 @@ public virtual SingleResultShaperExpression Update([NotNull] Expression projecti
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public sealed override ExpressionType NodeType => ExpressionType.Extension;
+ public sealed override ExpressionType NodeType
+ => ExpressionType.Extension;
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
@@ -82,6 +84,7 @@ public virtual SingleResultShaperExpression Update([NotNull] Expression projecti
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual Expression Projection { get; }
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
diff --git a/src/EFCore.InMemory/Storage/Internal/IInMemoryStore.cs b/src/EFCore.InMemory/Storage/Internal/IInMemoryStore.cs
index 98c1a002839..b124ad953d1 100644
--- a/src/EFCore.InMemory/Storage/Internal/IInMemoryStore.cs
+++ b/src/EFCore.InMemory/Storage/Internal/IInMemoryStore.cs
@@ -59,6 +59,7 @@ bool EnsureCreated(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
int ExecuteTransaction(
- [NotNull] IList entries, [NotNull] IDiagnosticsLogger updateLogger);
+ [NotNull] IList entries,
+ [NotNull] IDiagnosticsLogger updateLogger);
}
}
diff --git a/src/EFCore.InMemory/Storage/Internal/IInMemoryTable.cs b/src/EFCore.InMemory/Storage/Internal/IInMemoryTable.cs
index f997dcd6fff..7f117d483d2 100644
--- a/src/EFCore.InMemory/Storage/Internal/IInMemoryTable.cs
+++ b/src/EFCore.InMemory/Storage/Internal/IInMemoryTable.cs
@@ -64,7 +64,8 @@ public interface IInMemoryTable
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
InMemoryIntegerValueGenerator GetIntegerValueGenerator(
- [NotNull] IProperty property, [NotNull] IReadOnlyList tables);
+ [NotNull] IProperty property,
+ [NotNull] IReadOnlyList tables);
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.InMemory/Storage/Internal/InMemoryDatabase.cs b/src/EFCore.InMemory/Storage/Internal/InMemoryDatabase.cs
index 19d6e50395b..7da88972b8e 100644
--- a/src/EFCore.InMemory/Storage/Internal/InMemoryDatabase.cs
+++ b/src/EFCore.InMemory/Storage/Internal/InMemoryDatabase.cs
@@ -64,7 +64,8 @@ public InMemoryDatabase(
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual IInMemoryStore Store => _store;
+ public virtual IInMemoryStore Store
+ => _store;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.InMemory/Storage/Internal/InMemoryDatabaseCreator.cs b/src/EFCore.InMemory/Storage/Internal/InMemoryDatabaseCreator.cs
index e3b4a7fa2e3..28f04febe64 100644
--- a/src/EFCore.InMemory/Storage/Internal/InMemoryDatabaseCreator.cs
+++ b/src/EFCore.InMemory/Storage/Internal/InMemoryDatabaseCreator.cs
@@ -47,7 +47,8 @@ public InMemoryDatabaseCreator([NotNull] IDatabase database)
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- protected virtual IInMemoryDatabase Database => (IInMemoryDatabase)_database;
+ protected virtual IInMemoryDatabase Database
+ => (IInMemoryDatabase)_database;
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -73,7 +74,8 @@ public virtual Task EnsureDeletedAsync(CancellationToken cancellationToken
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual bool EnsureCreated() => Database.EnsureDatabaseCreated();
+ public virtual bool EnsureCreated()
+ => Database.EnsureDatabaseCreated();
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
diff --git a/src/EFCore.InMemory/Storage/Internal/InMemoryStore.cs b/src/EFCore.InMemory/Storage/Internal/InMemoryStore.cs
index 777ea37de53..bb080437f13 100644
--- a/src/EFCore.InMemory/Storage/Internal/InMemoryStore.cs
+++ b/src/EFCore.InMemory/Storage/Internal/InMemoryStore.cs
@@ -227,7 +227,6 @@ private IInMemoryTable EnsureTable(IEntityType entityType)
baseTable = table;
}
-
return _tables[_useNameMatching ? (object)entityType.FullName() : entityType];
}
}
diff --git a/src/EFCore.InMemory/Storage/Internal/InMemoryTable.cs b/src/EFCore.InMemory/Storage/Internal/InMemoryTable.cs
index 18a775b7eca..5e94d32626a 100644
--- a/src/EFCore.InMemory/Storage/Internal/InMemoryTable.cs
+++ b/src/EFCore.InMemory/Storage/Internal/InMemoryTable.cs
@@ -58,6 +58,7 @@ public InMemoryTable([NotNull] IEntityType entityType, [CanBeNull] IInMemoryTabl
{
_valueConverters = new List<(int, ValueConverter)>();
}
+
_valueConverters.Add((property.GetIndex(), converter));
}
@@ -68,6 +69,7 @@ public InMemoryTable([NotNull] IEntityType entityType, [CanBeNull] IInMemoryTabl
{
_valueComparers = new List<(int, ValueComparer)>();
}
+
_valueComparers.Add((property.GetIndex(), comparer));
}
}
@@ -96,7 +98,8 @@ public InMemoryTable([NotNull] IEntityType entityType, [CanBeNull] IInMemoryTabl
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
public virtual InMemoryIntegerValueGenerator GetIntegerValueGenerator(
- IProperty property, IReadOnlyList tables)
+ IProperty property,
+ IReadOnlyList tables)
{
if (_integerGenerators == null)
{
@@ -127,7 +130,8 @@ public virtual InMemoryIntegerValueGenerator GetIntegerValueGenerator
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
- public virtual IEnumerable