Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed May 15, 2024
1 parent ca7c0e8 commit fe06014
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 172 deletions.
2 changes: 0 additions & 2 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-runtime -->
<add key="darc-int-dotnet-runtime-087e153" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-runtime-087e1532/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-runtime -->
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
Expand All @@ -21,7 +20,6 @@
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-runtime -->
<add key="darc-int-dotnet-runtime-087e153" value="true" />
<!-- End: Package sources from dotnet-runtime -->
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
</disabledPackageSources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ namespace Microsoft.EntityFrameworkCore.Query;
/// </summary>
public class RelationalStructuralTypeShaperExpression : StructuralTypeShaperExpression
{
private static readonly bool UseOldBehavior33547 =
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue33547", out var enabled33547) && enabled33547;

/// <summary>
/// Creates a new instance of the <see cref="RelationalStructuralTypeShaperExpression" /> class.
/// </summary>
Expand Down Expand Up @@ -166,8 +163,7 @@ public override StructuralTypeShaperExpression MakeNullable(bool nullable = true
}

var newValueBufferExpression = ValueBufferExpression;
if (!UseOldBehavior33547
&& StructuralType is IComplexType
if (StructuralType is IComplexType
&& ValueBufferExpression is StructuralTypeProjectionExpression structuralTypeProjectionExpression)
{
// for complex types we also need to go inside and mark all properties there as nullable
Expand Down
30 changes: 0 additions & 30 deletions test/EFCore.Specification.Tests/Query/ComplexTypeQueryTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -852,36 +852,6 @@ public virtual Task Entity_with_complex_type_with_group_by_and_first(bool async)

#endregion GroupBy

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Projecting_property_of_complex_type_using_left_join_with_pushdown(bool async)
=> AssertQuery(
async,
ss => from cg in ss.Set<CustomerGroup>()
join c in ss.Set<Customer>().Where(x => x.Id > 5) on cg.Id equals c.Id into grouping
from c in grouping.DefaultIfEmpty()
select c == null ? null : (int?)c.BillingAddress.ZipCode);

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Projecting_complex_from_optional_navigation_using_conditional(bool async)
=> AssertQuery(
async,
ss => ss.Set<CustomerGroup>().Select(x => x.OptionalCustomer == null ? null : x.OptionalCustomer.ShippingAddress)
.OrderBy(x => x!.ZipCode).Take(20).Distinct().Select(x => (int?)x!.ZipCode),
ss => ss.Set<CustomerGroup>().Select(x => x.OptionalCustomer == null ? null : x.OptionalCustomer.ShippingAddress)
.OrderBy(x => x.MaybeScalar(xx => xx!.ZipCode)).Take(20).Distinct().Select(x => x.MaybeScalar(xx => xx!.ZipCode)));

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Project_entity_with_complex_type_pushdown_and_then_left_join(bool async)
=> AssertQuery(
async,
ss => from c1 in ss.Set<Customer>().OrderBy(x => x.Id).Take(20).Distinct()
join c2 in ss.Set<Customer>().OrderByDescending(x => x.Id).Take(30).Distinct() on c1.Id equals c2.Id into grouping
from c2 in grouping.DefaultIfEmpty()
select new { Zip1 = c1.BillingAddress.ZipCode, Zip2 = c2.ShippingAddress.ZipCode });

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Projecting_property_of_complex_type_using_left_join_with_pushdown(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1260,72 +1260,6 @@ public override async Task Project_entity_with_complex_type_pushdown_and_then_le
""");
}

public override async Task Projecting_property_of_complex_type_using_left_join_with_pushdown(bool async)
{
await base.Projecting_property_of_complex_type_using_left_join_with_pushdown(async);

AssertSql(
"""
SELECT [t].[BillingAddress_ZipCode]
FROM [CustomerGroup] AS [c]
LEFT JOIN (
SELECT [c0].[Id], [c0].[BillingAddress_ZipCode]
FROM [Customer] AS [c0]
WHERE [c0].[Id] > 5
) AS [t] ON [c].[Id] = [t].[Id]
""");
}

public override async Task Projecting_complex_from_optional_navigation_using_conditional(bool async)
{
await base.Projecting_complex_from_optional_navigation_using_conditional(async);

AssertSql(
"""
@__p_0='20'

SELECT [t0].[ShippingAddress_ZipCode]
FROM (
SELECT DISTINCT [t].[ShippingAddress_AddressLine1], [t].[ShippingAddress_AddressLine2], [t].[ShippingAddress_ZipCode], [t].[ShippingAddress_Country_Code], [t].[ShippingAddress_Country_FullName]
FROM (
SELECT TOP(@__p_0) [c0].[ShippingAddress_AddressLine1], [c0].[ShippingAddress_AddressLine2], [c0].[ShippingAddress_ZipCode], [c0].[ShippingAddress_Country_Code], [c0].[ShippingAddress_Country_FullName]
FROM [CustomerGroup] AS [c]
LEFT JOIN [Customer] AS [c0] ON [c].[OptionalCustomerId] = [c0].[Id]
ORDER BY [c0].[ShippingAddress_ZipCode]
) AS [t]
) AS [t0]
""");
}

public override async Task Project_entity_with_complex_type_pushdown_and_then_left_join(bool async)
{
await base.Project_entity_with_complex_type_pushdown_and_then_left_join(async);

AssertSql(
"""
@__p_0='20'
@__p_1='30'

SELECT [t0].[BillingAddress_ZipCode] AS [Zip1], [t1].[ShippingAddress_ZipCode] AS [Zip2]
FROM (
SELECT DISTINCT [t].[Id], [t].[Name], [t].[BillingAddress_AddressLine1], [t].[BillingAddress_AddressLine2], [t].[BillingAddress_ZipCode], [t].[BillingAddress_Country_Code], [t].[BillingAddress_Country_FullName], [t].[ShippingAddress_AddressLine1], [t].[ShippingAddress_AddressLine2], [t].[ShippingAddress_ZipCode], [t].[ShippingAddress_Country_Code], [t].[ShippingAddress_Country_FullName]
FROM (
SELECT TOP(@__p_0) [c].[Id], [c].[Name], [c].[BillingAddress_AddressLine1], [c].[BillingAddress_AddressLine2], [c].[BillingAddress_ZipCode], [c].[BillingAddress_Country_Code], [c].[BillingAddress_Country_FullName], [c].[ShippingAddress_AddressLine1], [c].[ShippingAddress_AddressLine2], [c].[ShippingAddress_ZipCode], [c].[ShippingAddress_Country_Code], [c].[ShippingAddress_Country_FullName]
FROM [Customer] AS [c]
ORDER BY [c].[Id]
) AS [t]
) AS [t0]
LEFT JOIN (
SELECT DISTINCT [t2].[Id], [t2].[Name], [t2].[BillingAddress_AddressLine1], [t2].[BillingAddress_AddressLine2], [t2].[BillingAddress_ZipCode], [t2].[BillingAddress_Country_Code], [t2].[BillingAddress_Country_FullName], [t2].[ShippingAddress_AddressLine1], [t2].[ShippingAddress_AddressLine2], [t2].[ShippingAddress_ZipCode], [t2].[ShippingAddress_Country_Code], [t2].[ShippingAddress_Country_FullName]
FROM (
SELECT TOP(@__p_1) [c0].[Id], [c0].[Name], [c0].[BillingAddress_AddressLine1], [c0].[BillingAddress_AddressLine2], [c0].[BillingAddress_ZipCode], [c0].[BillingAddress_Country_Code], [c0].[BillingAddress_Country_FullName], [c0].[ShippingAddress_AddressLine1], [c0].[ShippingAddress_AddressLine2], [c0].[ShippingAddress_ZipCode], [c0].[ShippingAddress_Country_Code], [c0].[ShippingAddress_Country_FullName]
FROM [Customer] AS [c0]
ORDER BY [c0].[Id] DESC
) AS [t2]
) AS [t1] ON [t0].[Id] = [t1].[Id]
""");
}

[ConditionalFact]
public virtual void Check_all_tests_overridden()
=> TestHelpers.AssertAllMethodsOverridden(GetType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1146,75 +1146,6 @@ LIMIT @__p_1
""");
}

public override async Task Projecting_property_of_complex_type_using_left_join_with_pushdown(bool async)
{
await base.Projecting_property_of_complex_type_using_left_join_with_pushdown(async);

AssertSql(
"""
SELECT "t"."BillingAddress_ZipCode"
FROM "CustomerGroup" AS "c"
LEFT JOIN (
SELECT "c0"."Id", "c0"."BillingAddress_ZipCode"
FROM "Customer" AS "c0"
WHERE "c0"."Id" > 5
) AS "t" ON "c"."Id" = "t"."Id"
""");
}

public override async Task Projecting_complex_from_optional_navigation_using_conditional(bool async)
{
await base.Projecting_complex_from_optional_navigation_using_conditional(async);

AssertSql(
"""
@__p_0='20'

SELECT "t0"."ShippingAddress_ZipCode"
FROM (
SELECT DISTINCT "t"."ShippingAddress_AddressLine1", "t"."ShippingAddress_AddressLine2", "t"."ShippingAddress_ZipCode", "t"."ShippingAddress_Country_Code", "t"."ShippingAddress_Country_FullName"
FROM (
SELECT "c0"."ShippingAddress_AddressLine1", "c0"."ShippingAddress_AddressLine2", "c0"."ShippingAddress_ZipCode", "c0"."ShippingAddress_Country_Code", "c0"."ShippingAddress_Country_FullName"
FROM "CustomerGroup" AS "c"
LEFT JOIN "Customer" AS "c0" ON "c"."OptionalCustomerId" = "c0"."Id"
ORDER BY "c0"."ShippingAddress_ZipCode"
LIMIT @__p_0
) AS "t"
) AS "t0"
""");
}

public override async Task Project_entity_with_complex_type_pushdown_and_then_left_join(bool async)
{
await base.Project_entity_with_complex_type_pushdown_and_then_left_join(async);

AssertSql(
"""
@__p_0='20'
@__p_1='30'

SELECT "t0"."BillingAddress_ZipCode" AS "Zip1", "t1"."ShippingAddress_ZipCode" AS "Zip2"
FROM (
SELECT DISTINCT "t"."Id", "t"."Name", "t"."BillingAddress_AddressLine1", "t"."BillingAddress_AddressLine2", "t"."BillingAddress_ZipCode", "t"."BillingAddress_Country_Code", "t"."BillingAddress_Country_FullName", "t"."ShippingAddress_AddressLine1", "t"."ShippingAddress_AddressLine2", "t"."ShippingAddress_ZipCode", "t"."ShippingAddress_Country_Code", "t"."ShippingAddress_Country_FullName"
FROM (
SELECT "c"."Id", "c"."Name", "c"."BillingAddress_AddressLine1", "c"."BillingAddress_AddressLine2", "c"."BillingAddress_ZipCode", "c"."BillingAddress_Country_Code", "c"."BillingAddress_Country_FullName", "c"."ShippingAddress_AddressLine1", "c"."ShippingAddress_AddressLine2", "c"."ShippingAddress_ZipCode", "c"."ShippingAddress_Country_Code", "c"."ShippingAddress_Country_FullName"
FROM "Customer" AS "c"
ORDER BY "c"."Id"
LIMIT @__p_0
) AS "t"
) AS "t0"
LEFT JOIN (
SELECT DISTINCT "t2"."Id", "t2"."Name", "t2"."BillingAddress_AddressLine1", "t2"."BillingAddress_AddressLine2", "t2"."BillingAddress_ZipCode", "t2"."BillingAddress_Country_Code", "t2"."BillingAddress_Country_FullName", "t2"."ShippingAddress_AddressLine1", "t2"."ShippingAddress_AddressLine2", "t2"."ShippingAddress_ZipCode", "t2"."ShippingAddress_Country_Code", "t2"."ShippingAddress_Country_FullName"
FROM (
SELECT "c0"."Id", "c0"."Name", "c0"."BillingAddress_AddressLine1", "c0"."BillingAddress_AddressLine2", "c0"."BillingAddress_ZipCode", "c0"."BillingAddress_Country_Code", "c0"."BillingAddress_Country_FullName", "c0"."ShippingAddress_AddressLine1", "c0"."ShippingAddress_AddressLine2", "c0"."ShippingAddress_ZipCode", "c0"."ShippingAddress_Country_Code", "c0"."ShippingAddress_Country_FullName"
FROM "Customer" AS "c0"
ORDER BY "c0"."Id" DESC
LIMIT @__p_1
) AS "t2"
) AS "t1" ON "t0"."Id" = "t1"."Id"
""");
}

[ConditionalFact]
public virtual void Check_all_tests_overridden()
=> TestHelpers.AssertAllMethodsOverridden(GetType());
Expand Down

0 comments on commit fe06014

Please sign in to comment.