Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[automated] Merge branch 'release/8.0' => 'main' #31852

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.Extensions.Caching.Memory" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.Extensions.Caching.Memory" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Configuration.Json" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.Extensions.Configuration.Json" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Configuration" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.Extensions.Configuration" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.DependencyInjection" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.Extensions.DependencyInjection" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.DependencyModel" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.Extensions.DependencyModel" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.HostFactoryResolver.Sources" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.Extensions.HostFactoryResolver.Sources" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Logging" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.Extensions.Logging" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="System.Text.Json" Version="8.0.0-rtm.23472.12">
<Dependency Name="System.Text.Json" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.NETCore.App.Ref" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
<!-- NB: Using BrowserDebugHost to represent the nonshipping version of Microsoft.NETCore.App -->
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="8.0.0-rtm.23472.12">
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="8.0.0-rtm.23475.7">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>e95228dbcf7a69f87b00da969b0cabf2e62ab207</Sha>
<Sha>a3d5300baee03169bf737cfc4e9b1f7dbece4d05</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
Expand Down
26 changes: 13 additions & 13 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
<UsingToolXliff>False</UsingToolXliff>
</PropertyGroup>
<PropertyGroup Label="Dependencies from dotnet/runtime">
<MicrosoftExtensionsCachingMemoryVersion>8.0.0-rtm.23472.12</MicrosoftExtensionsCachingMemoryVersion>
<MicrosoftExtensionsConfigurationVersion>8.0.0-rtm.23472.12</MicrosoftExtensionsConfigurationVersion>
<MicrosoftExtensionsConfigurationAbstractionsVersion>8.0.0-rtm.23472.12</MicrosoftExtensionsConfigurationAbstractionsVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>8.0.0-rtm.23472.12</MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>
<MicrosoftExtensionsConfigurationJsonVersion>8.0.0-rtm.23472.12</MicrosoftExtensionsConfigurationJsonVersion>
<MicrosoftExtensionsDependencyInjectionVersion>8.0.0-rtm.23472.12</MicrosoftExtensionsDependencyInjectionVersion>
<MicrosoftExtensionsDependencyModelVersion>8.0.0-rtm.23472.12</MicrosoftExtensionsDependencyModelVersion>
<MicrosoftExtensionsHostFactoryResolverSourcesVersion>8.0.0-rtm.23472.12</MicrosoftExtensionsHostFactoryResolverSourcesVersion>
<MicrosoftExtensionsLoggingVersion>8.0.0-rtm.23472.12</MicrosoftExtensionsLoggingVersion>
<SystemTextJsonVersion>8.0.0-rtm.23472.12</SystemTextJsonVersion>
<MicrosoftNETCoreAppRefVersion>8.0.0-rtm.23472.12</MicrosoftNETCoreAppRefVersion>
<MicrosoftNETCoreAppRuntimewinx64Version>8.0.0-rtm.23472.12</MicrosoftNETCoreAppRuntimewinx64Version>
<MicrosoftNETCoreBrowserDebugHostTransportVersion>8.0.0-rtm.23472.12</MicrosoftNETCoreBrowserDebugHostTransportVersion>
<MicrosoftExtensionsCachingMemoryVersion>8.0.0-rtm.23475.7</MicrosoftExtensionsCachingMemoryVersion>
<MicrosoftExtensionsConfigurationVersion>8.0.0-rtm.23475.7</MicrosoftExtensionsConfigurationVersion>
<MicrosoftExtensionsConfigurationAbstractionsVersion>8.0.0-rtm.23475.7</MicrosoftExtensionsConfigurationAbstractionsVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>8.0.0-rtm.23475.7</MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>
<MicrosoftExtensionsConfigurationJsonVersion>8.0.0-rtm.23475.7</MicrosoftExtensionsConfigurationJsonVersion>
<MicrosoftExtensionsDependencyInjectionVersion>8.0.0-rtm.23475.7</MicrosoftExtensionsDependencyInjectionVersion>
<MicrosoftExtensionsDependencyModelVersion>8.0.0-rtm.23475.7</MicrosoftExtensionsDependencyModelVersion>
<MicrosoftExtensionsHostFactoryResolverSourcesVersion>8.0.0-rtm.23475.7</MicrosoftExtensionsHostFactoryResolverSourcesVersion>
<MicrosoftExtensionsLoggingVersion>8.0.0-rtm.23475.7</MicrosoftExtensionsLoggingVersion>
<SystemTextJsonVersion>8.0.0-rtm.23475.7</SystemTextJsonVersion>
<MicrosoftNETCoreAppRefVersion>8.0.0-rtm.23475.7</MicrosoftNETCoreAppRefVersion>
<MicrosoftNETCoreAppRuntimewinx64Version>8.0.0-rtm.23475.7</MicrosoftNETCoreAppRuntimewinx64Version>
<MicrosoftNETCoreBrowserDebugHostTransportVersion>8.0.0-rtm.23475.7</MicrosoftNETCoreBrowserDebugHostTransportVersion>
</PropertyGroup>
<PropertyGroup Label="Dependencies from dotnet/arcade">
<MicrosoftDotNetBuildTasksTemplatingVersion>8.0.0-beta.23463.1</MicrosoftDotNetBuildTasksTemplatingVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.EntityFrameworkCore.TestModels.OptionalDependent;

namespace Microsoft.EntityFrameworkCore.Query;

public abstract class OptionalDependentQueryFixtureBase : SharedStoreFixtureBase<OptionalDependentContext>, IQueryFixtureBase
{
private OptionalDependentData _expectedData;

public Func<DbContext> GetContextCreator()
=> () => CreateContext();

public virtual ISetSource GetExpectedData()
=> _expectedData ??= new OptionalDependentData();

public IReadOnlyDictionary<Type, object> EntitySorters { get; } = new Dictionary<Type, Func<object, object>>
{
{ typeof(OptionalDependentEntityAllOptional), e => ((OptionalDependentEntityAllOptional)e)?.Id },
{ typeof(OptionalDependentEntitySomeRequired), e => ((OptionalDependentEntitySomeRequired)e)?.Id },
}.ToDictionary(e => e.Key, e => (object)e.Value);

public IReadOnlyDictionary<Type, object> EntityAsserters { get; } = new Dictionary<Type, Action<object, object>>
{
{
typeof(OptionalDependentEntityAllOptional), (e, a) =>
{
Assert.Equal(e == null, a == null);
if (a != null)
{
var ee = (OptionalDependentEntityAllOptional)e;
var aa = (OptionalDependentEntityAllOptional)a;

Assert.Equal(ee.Id, aa.Id);
Assert.Equal(ee.Name, aa.Name);

if (ee.Json is not null || aa.Json is not null)
{
AssertOptionalDependentJsonAllOptional(ee.Json, aa.Json);
}
}
}
},
{
typeof(OptionalDependentEntitySomeRequired), (e, a) =>
{
Assert.Equal(e == null, a == null);
if (a != null)
{
var ee = (OptionalDependentEntitySomeRequired)e;
var aa = (OptionalDependentEntitySomeRequired)a;

Assert.Equal(ee.Id, aa.Id);
Assert.Equal(ee.Name, aa.Name);

if (ee.Json is not null || aa.Json is not null)
{
AssertOptionalDependentJsonSomeRequired(ee.Json, aa.Json);
}
}
}
},
}.ToDictionary(e => e.Key, e => (object)e.Value);

public static void AssertOptionalDependentJsonAllOptional(
OptionalDependentJsonAllOptional expected,
OptionalDependentJsonAllOptional actual)
{
Assert.Equal(expected.OpProp1, actual.OpProp1);
Assert.Equal(expected.OpProp2, actual.OpProp2);

if (expected.OpNested1 is not null || actual.OpNested1 is not null)
{
AssertOptionalDependentNestedJsonAllOptional(expected.OpNested1, actual.OpNested1);
}

if (expected.OpNested2 is not null || actual.OpNested2 is not null)
{
AssertOptionalDependentNestedJsonSomeRequired(expected.OpNested2, actual.OpNested2);
}
}

public static void AssertOptionalDependentJsonSomeRequired(
OptionalDependentJsonSomeRequired expected,
OptionalDependentJsonSomeRequired actual)
{
Assert.Equal(expected.OpProp1, actual.OpProp1);
Assert.Equal(expected.OpProp2, actual.OpProp2);
Assert.Equal(expected.ReqProp, actual.ReqProp);


if (expected.OpNested1 is not null || actual.OpNested1 is not null)
{
AssertOptionalDependentNestedJsonAllOptional(expected.OpNested1, actual.OpNested1);
}

if (expected.OpNested2 is not null || actual.OpNested2 is not null)
{
AssertOptionalDependentNestedJsonSomeRequired(expected.OpNested2, actual.OpNested2);
}

AssertOptionalDependentNestedJsonAllOptional(expected.ReqNested1, actual.ReqNested1);
AssertOptionalDependentNestedJsonSomeRequired(expected.ReqNested2, actual.ReqNested2);
}

public static void AssertOptionalDependentNestedJsonAllOptional(
OptionalDependentNestedJsonAllOptional expected,
OptionalDependentNestedJsonAllOptional actual)
{
Assert.Equal(expected.OpNested1, actual.OpNested1);
Assert.Equal(expected.OpNested2, actual.OpNested2);
}

public static void AssertOptionalDependentNestedJsonSomeRequired(
OptionalDependentNestedJsonSomeRequired expected,
OptionalDependentNestedJsonSomeRequired actual)
{
Assert.Equal(expected.OpNested1, actual.OpNested1);
Assert.Equal(expected.OpNested2, actual.OpNested2);
Assert.Equal(expected.ReqNested1, actual.ReqNested1);
Assert.Equal(expected.ReqNested2, actual.ReqNested2);
}

protected override string StoreName { get; } = "OptionalDependentQueryTest";

public new RelationalTestStore TestStore
=> (RelationalTestStore)base.TestStore;

public TestSqlLoggerFactory TestSqlLoggerFactory
=> (TestSqlLoggerFactory)ListLoggerFactory;

protected override void Seed(OptionalDependentContext context)
=> OptionalDependentContext.Seed(context);

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
modelBuilder.Entity<OptionalDependentEntityAllOptional>().Property(x => x.Id).ValueGeneratedNever();
modelBuilder.Entity<OptionalDependentEntitySomeRequired>().Property(x => x.Id).ValueGeneratedNever();

modelBuilder.Entity<OptionalDependentEntityAllOptional>().OwnsOne(
x => x.Json, b =>
{
b.ToJson();

b.OwnsOne(x => x.OpNested1);
b.OwnsOne(x => x.OpNested2);
});

modelBuilder.Entity<OptionalDependentEntitySomeRequired>().OwnsOne(
x => x.Json, b =>
{
b.ToJson();

b.OwnsOne(x => x.OpNested1);
b.OwnsOne(x => x.OpNested2);

b.OwnsOne(x => x.ReqNested1);
b.Navigation(x => x.ReqNested1).IsRequired();
b.OwnsOne(x => x.ReqNested2);
b.Navigation(x => x.ReqNested2).IsRequired();
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.EntityFrameworkCore.TestModels.OptionalDependent;

namespace Microsoft.EntityFrameworkCore.Query;

public abstract class OptionalDependentQueryTestBase<TFixture> : QueryTestBase<TFixture>
where TFixture : OptionalDependentQueryFixtureBase, new()
{
protected OptionalDependentQueryTestBase(TFixture fixture)
: base(fixture)
{
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Basic_projection_entity_with_all_optional(bool async)
=> AssertQuery(
async,
ss => ss.Set<OptionalDependentEntityAllOptional>(),
entryCount: 35);

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Basic_projection_entity_with_some_required(bool async)
=> AssertQuery(
async,
ss => ss.Set<OptionalDependentEntitySomeRequired>(),
entryCount: 59);

[ConditionalTheory(Skip = "issue #30589")]
[MemberData(nameof(IsAsyncData))]
public virtual Task Filter_optional_dependent_with_all_optional_compared_to_null(bool async)
=> AssertQuery(
async,
ss => ss.Set<OptionalDependentEntityAllOptional>().Where(x => x.Json == null),
entryCount: 35);

[ConditionalTheory(Skip = "issue #30589")]
[MemberData(nameof(IsAsyncData))]
public virtual Task Filter_optional_dependent_with_all_optional_compared_to_not_null(bool async)
=> AssertQuery(
async,
ss => ss.Set<OptionalDependentEntityAllOptional>().Where(x => x.Json != null),
entryCount: 35);

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Filter_optional_dependent_with_some_required_compared_to_null(bool async)
=> AssertQuery(
async,
ss => ss.Set<OptionalDependentEntitySomeRequired>().Where(x => x.Json == null),
entryCount: 0);

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Filter_optional_dependent_with_some_required_compared_to_not_null(bool async)
=> AssertQuery(
async,
ss => ss.Set<OptionalDependentEntitySomeRequired>().Where(x => x.Json != null),
entryCount: 59);

[ConditionalTheory(Skip = "issue #30589")]
[MemberData(nameof(IsAsyncData))]
public virtual Task Filter_nested_optional_dependent_with_all_optional_compared_to_null(bool async)
=> AssertQuery(
async,
ss => ss.Set<OptionalDependentEntityAllOptional>().Where(x => x.Json.OpNested1 == null),
entryCount: 59);

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Filter_nested_optional_dependent_with_all_optional_compared_to_not_null(bool async)
=> AssertQuery(
async,
ss => ss.Set<OptionalDependentEntityAllOptional>().Where(x => x.Json.OpNested2 != null),
entryCount: 23);

[ConditionalTheory(Skip = "issue #30589")]
[MemberData(nameof(IsAsyncData))]
public virtual Task Filter_nested_optional_dependent_with_some_required_compared_to_null(bool async)
=> AssertQuery(
async,
ss => ss.Set<OptionalDependentEntitySomeRequired>().Where(x => x.Json.ReqNested1 == null),
entryCount: 59);

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Filter_nested_optional_dependent_with_some_required_compared_to_not_null(bool async)
=> AssertQuery(
async,
ss => ss.Set<OptionalDependentEntitySomeRequired>().Where(x => x.Json.ReqNested2 != null),
entryCount: 59);
}
Loading