Skip to content

Commit ed8a826

Browse files
github-actions[bot]dotnet-maestro[bot]cincuranetCopilotAndriySvyryd
authored
[automated] Merge branch 'release/10.0' => 'main' (#36812)
* Update dependencies from https://github.com/dotnet/dotnet build 283422 Updated Dependencies: Microsoft.DotNet.Arcade.Sdk, Microsoft.DotNet.Build.Tasks.Templating, Microsoft.DotNet.Helix.Sdk (Version 10.0.0-beta.25464.104 -> 10.0.0-beta.25466.101) Microsoft.Extensions.Caching.Memory, Microsoft.Extensions.Configuration, Microsoft.Extensions.Configuration.Abstractions, Microsoft.Extensions.Configuration.EnvironmentVariables, Microsoft.Extensions.Configuration.Json, Microsoft.Extensions.DependencyInjection, Microsoft.Extensions.DependencyModel, Microsoft.Extensions.HostFactoryResolver.Sources, Microsoft.Extensions.Logging, Microsoft.NETCore.App.Ref, Microsoft.NETCore.Platforms, System.Formats.Asn1, System.Runtime.Caching, System.Text.Encodings.Web, System.Text.Json (Version 10.0.0-rc.2.25464.104 -> 10.0.0-rc.2.25466.101) * [rc2] Fix race condition in SingletonCosmosClientWrapper.Client (#36767) Fixes #36714 Co-authored-by: AndriySvyryd <[email protected]> * Fix ExecuteUpdate parameters for multiple properties with same name (#36792) And validate against null required properties in JSON serialization. Fixes #36791 * Stop transforming complex property access to EF.Property (#36786) Fixes #36761 --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Jiri Cincura ↹ <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: AndriySvyryd <[email protected]> Co-authored-by: Shay Rojansky <[email protected]>
1 parent e47e93a commit ed8a826

File tree

46 files changed

+554
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+554
-136
lines changed

src/EFCore.Cosmos/Metadata/Conventions/Internal/CosmosConventionSetBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private static IServiceScope CreateServiceScope()
8282
var serviceProvider = new ServiceCollection()
8383
.AddEntityFrameworkCosmos()
8484
.AddDbContext<DbContext>((p, o) =>
85-
o.UseCosmos("localhost", "_", "_")
85+
o.UseCosmos("https://localhost:8081", "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==", "_")
8686
.UseInternalServiceProvider(p))
8787
.BuildServiceProvider();
8888

src/EFCore.Cosmos/Query/Internal/CosmosQueryTranslationPostprocessorFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class CosmosQueryTranslationPostprocessorFactory(
2525
/// any release. You should only use it directly in your code with extreme caution and knowing that
2626
/// doing so can result in application failures when updating to a new Entity Framework Core release.
2727
/// </summary>
28+
[DebuggerStepThrough]
2829
public virtual QueryTranslationPostprocessor Create(QueryCompilationContext queryCompilationContext)
2930
=> new CosmosQueryTranslationPostprocessor(
3031
Dependencies,

src/EFCore.Cosmos/Query/Internal/CosmosQueryTranslationPreprocessorFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class CosmosQueryTranslationPreprocessorFactory(QueryTranslationPreproces
2323
/// any release. You should only use it directly in your code with extreme caution and knowing that
2424
/// doing so can result in application failures when updating to a new Entity Framework Core release.
2525
/// </summary>
26+
[DebuggerStepThrough]
2627
public virtual QueryTranslationPreprocessor Create(QueryCompilationContext queryCompilationContext)
2728
=> new CosmosQueryTranslationPreprocessor(Dependencies, (CosmosQueryCompilationContext)queryCompilationContext);
2829
}

src/EFCore.Cosmos/Query/Internal/CosmosQueryableMethodTranslatingExpressionVisitorFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class CosmosQueryableMethodTranslatingExpressionVisitorFactory(
2828
/// any release. You should only use it directly in your code with extreme caution and knowing that
2929
/// doing so can result in application failures when updating to a new Entity Framework Core release.
3030
/// </summary>
31+
[DebuggerStepThrough]
3132
public virtual QueryableMethodTranslatingExpressionVisitor Create(QueryCompilationContext queryCompilationContext)
3233
=> new CosmosQueryableMethodTranslatingExpressionVisitor(
3334
Dependencies,

src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitorFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class CosmosShapedQueryCompilingExpressionVisitorFactory(
2828
/// any release. You should only use it directly in your code with extreme caution and knowing that
2929
/// doing so can result in application failures when updating to a new Entity Framework Core release.
3030
/// </summary>
31+
[DebuggerStepThrough]
3132
public virtual ShapedQueryCompilingExpressionVisitor Create(QueryCompilationContext queryCompilationContext)
3233
=> new CosmosShapedQueryCompilingExpressionVisitor(
3334
Dependencies,

src/EFCore.Cosmos/Storage/Internal/SingletonCosmosClientWrapper.cs

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ namespace Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal;
1616
public class SingletonCosmosClientWrapper : ISingletonCosmosClientWrapper
1717
{
1818
private static readonly string UserAgent = " Microsoft.EntityFrameworkCore.Cosmos/" + ProductInfo.GetVersion();
19-
private readonly CosmosClientOptions _options;
20-
private readonly string? _endpoint;
21-
private readonly string? _key;
22-
private readonly string? _connectionString;
23-
private readonly TokenCredential? _tokenCredential;
24-
private CosmosClient? _client;
19+
private readonly CosmosClient _client;
2520

2621
/// <summary>
2722
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -31,10 +26,6 @@ public class SingletonCosmosClientWrapper : ISingletonCosmosClientWrapper
3126
/// </summary>
3227
public SingletonCosmosClientWrapper(ICosmosSingletonOptions options)
3328
{
34-
_endpoint = options.AccountEndpoint;
35-
_key = options.AccountKey;
36-
_connectionString = options.ConnectionString;
37-
_tokenCredential = options.TokenCredential;
3829
var configuration = new CosmosClientOptions { ApplicationName = UserAgent, Serializer = new JsonCosmosSerializer() };
3930

4031
if (options.Region != null)
@@ -97,7 +88,13 @@ public SingletonCosmosClientWrapper(ICosmosSingletonOptions options)
9788
configuration.HttpClientFactory = options.HttpClientFactory;
9889
}
9990

100-
_options = configuration;
91+
_client = options switch
92+
{
93+
{ ConnectionString: not null and not "" } => new CosmosClient(options.ConnectionString, configuration),
94+
{ TokenCredential: not null } => new CosmosClient(options.AccountEndpoint, options.TokenCredential, configuration),
95+
{ AccountEndpoint: not null } => new CosmosClient(options.AccountEndpoint, options.AccountKey, configuration),
96+
_ => throw new InvalidOperationException(CosmosStrings.ConnectionInfoMissing)
97+
};
10198
}
10299

103100
/// <summary>
@@ -106,14 +103,7 @@ public SingletonCosmosClientWrapper(ICosmosSingletonOptions options)
106103
/// any release. You should only use it directly in your code with extreme caution and knowing that
107104
/// doing so can result in application failures when updating to a new Entity Framework Core release.
108105
/// </summary>
109-
public virtual CosmosClient Client
110-
=> _client ??= string.IsNullOrEmpty(_connectionString)
111-
? _tokenCredential == null
112-
? _endpoint == null
113-
? throw new InvalidOperationException(CosmosStrings.ConnectionInfoMissing)
114-
: new CosmosClient(_endpoint, _key, _options)
115-
: new CosmosClient(_endpoint, _tokenCredential, _options)
116-
: new CosmosClient(_connectionString, _options);
106+
public virtual CosmosClient Client => _client;
117107

118108
/// <summary>
119109
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -123,7 +113,6 @@ public virtual CosmosClient Client
123113
/// </summary>
124114
public virtual void Dispose()
125115
{
126-
_client?.Dispose();
127-
_client = null;
116+
_client.Dispose();
128117
}
129118
}

src/EFCore.InMemory/Query/Internal/InMemoryQueryTranslationPreprocessorFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public InMemoryQueryTranslationPreprocessorFactory(
3232
/// any release. You should only use it directly in your code with extreme caution and knowing that
3333
/// doing so can result in application failures when updating to a new Entity Framework Core release.
3434
/// </summary>
35+
[DebuggerStepThrough]
3536
public virtual QueryTranslationPreprocessor Create(QueryCompilationContext queryCompilationContext)
3637
=> new InMemoryQueryTranslationPreprocessor(Dependencies, queryCompilationContext);
3738
}

src/EFCore.InMemory/Query/Internal/InMemoryQueryableMethodTranslatingExpressionVisitorFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public InMemoryQueryableMethodTranslatingExpressionVisitorFactory(
3232
/// any release. You should only use it directly in your code with extreme caution and knowing that
3333
/// doing so can result in application failures when updating to a new Entity Framework Core release.
3434
/// </summary>
35+
[DebuggerStepThrough]
3536
public virtual QueryableMethodTranslatingExpressionVisitor Create(QueryCompilationContext queryCompilationContext)
3637
=> new InMemoryQueryableMethodTranslatingExpressionVisitor(Dependencies, queryCompilationContext);
3738
}

src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryExpressionVisitorFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public InMemoryShapedQueryCompilingExpressionVisitorFactory(
3232
/// any release. You should only use it directly in your code with extreme caution and knowing that
3333
/// doing so can result in application failures when updating to a new Entity Framework Core release.
3434
/// </summary>
35+
[DebuggerStepThrough]
3536
public virtual ShapedQueryCompilingExpressionVisitor Create(QueryCompilationContext queryCompilationContext)
3637
=> new InMemoryShapedQueryCompilingExpressionVisitor(Dependencies, queryCompilationContext);
3738
}

src/EFCore.Relational/Properties/RelationalStrings.Designer.cs

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)