Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,12 @@ public override Task Client_projection_via_ctor_arguments(bool async)
return base.Client_projection_via_ctor_arguments(async);
}

[ConditionalTheory(Skip = "Cross collection join Issue#17246")]
public override Task Client_projection_with_string_initialization_with_scalar_subquery(bool async)
{
return base.Client_projection_with_string_initialization_with_scalar_subquery(async);
}

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2373,5 +2373,53 @@ public OrderInfo(int orderID, DateTime? orderDate)
public DateTime? OrderDate { get; }
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Client_projection_with_string_initialization_with_scalar_subquery(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Customer>()
.Where(c => c.CustomerID.StartsWith("F"))
.Select(c => new
{
c.CustomerID,
Order = c.Orders.FirstOrDefault(o => o.OrderID < 11000).OrderDate,
InterpolatedString = $"test{c.City}",
NonInterpolatedString = "test" + c.City,
Collection = new List<string>
{
$"{c.CustomerID}@test1.com",
$"{c.CustomerID}@test2.com",
$"{c.CustomerID}@test3.com",
$"{c.CustomerID}@test4.com"
}
}),
ss => ss.Set<Customer>()
.Where(c => c.CustomerID.StartsWith("F"))
.Select(c => new
{
c.CustomerID,
Order = c.Orders.FirstOrDefault(o => o.OrderID < 11000).MaybeScalar(e => e.OrderDate),
InterpolatedString = $"test{c.City}",
NonInterpolatedString = "test" + c.City,
Collection = new List<string>
{
$"{c.CustomerID}@test1.com",
$"{c.CustomerID}@test2.com",
$"{c.CustomerID}@test3.com",
$"{c.CustomerID}@test4.com"
}
}),
elementSorter: e => e.CustomerID,
elementAsserter: (e, a) =>
{
AssertEqual(e.CustomerID, a.CustomerID);
AssertEqual(e.Order, a.Order);
AssertEqual(e.InterpolatedString, a.InterpolatedString);
AssertEqual(e.NonInterpolatedString, a.NonInterpolatedString);
AssertCollection(e.Collection, a.Collection, ordered: true);
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,19 @@ FROM [Customers] AS [c]
ORDER BY [t].[CustomerID]");
}

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

AssertSql(
@"SELECT [c].[CustomerID], (
SELECT TOP(1) [o].[OrderDate]
FROM [Orders] AS [o]
WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] < 11000)), [c].[City], N'test' + COALESCE([c].[City], N'')
FROM [Customers] AS [c]
WHERE [c].[CustomerID] LIKE N'F%'");
}

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);

Expand Down