Skip to content

Commit

Permalink
Merge in 'release/7.0' changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnet-bot committed Jan 12, 2023
2 parents d18e6a4 + 10f1d39 commit c5072f2
Show file tree
Hide file tree
Showing 20 changed files with 166 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.1" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.4" />
</ItemGroup>

<ItemGroup>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/EFCore.Relational/Properties/RelationalStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,9 @@
<data name="NoDbCommand" xml:space="preserve">
<value>Cannot create a DbCommand for a non-relational query.</value>
</data>
<data name="NonConstantOrParameterAsInExpressionValues" xml:space="preserve">
<value>Expression of type '{type}' isn't supported as the Values of an InExpression; only constants and parameters are supported.</value>
</data>
<data name="NoneRelationalTypeMappingOnARelationalTypeMappingSource" xml:space="preserve">
<value>'FindMapping' was called on a 'RelationalTypeMappingSource' with a non-relational 'TypeMappingInfo'.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ private sealed class SqlRemappingVisitor : ExpressionVisitor
private readonly HashSet<SqlExpression> _correlatedTerms;
private bool _groupByDiscovery;

private static readonly bool QuirkEnabled30022
= AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue30022", out var enabled) && enabled;

public SqlRemappingVisitor(
Dictionary<SqlExpression, ColumnExpression> mappings,
SelectExpression subquery,
Expand Down Expand Up @@ -210,7 +213,9 @@ when _groupByDiscovery

case SqlExpression sqlExpression
when !_groupByDiscovery
&& sqlExpression is not SqlConstantExpression or SqlParameterExpression
&& (QuirkEnabled30022
? sqlExpression is not SqlConstantExpression or SqlParameterExpression
: sqlExpression is not SqlConstantExpression and not SqlParameterExpression)
&& _correlatedTerms.Contains(sqlExpression):
var outerColumn = _subquery.GenerateOuterColumn(_tableReferenceExpression, sqlExpression);
_mappings[sqlExpression] = outerColumn;
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Sqlite/EFCore.Sqlite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.2" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.4" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore/Infrastructure/DatabaseFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ public virtual IDbContextTransaction? CurrentTransaction
/// See <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see> for more information and examples.
/// </para>
/// </remarks>
[Obsolete("Use EnableAutoTransactions instead")]
[Obsolete("Use " + nameof(AutoTransactionBehavior) + " instead")]
public virtual bool AutoTransactionsEnabled
{
get => AutoTransactionBehavior is AutoTransactionBehavior.Always or AutoTransactionBehavior.WhenNeeded;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Microsoft.Data.Sqlite.SqliteTransaction</Description>
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.core" Version="2.1.2" />
<PackageReference Include="SQLitePCLRaw.core" Version="2.1.4" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Data.Sqlite/Microsoft.Data.Sqlite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Microsoft.Data.Sqlite.SqliteTransaction</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.2" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.4" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/EFCore.Design.Tests/EFCore.Design.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelVersion)" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.2" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,26 @@ public virtual Task Skip_Take_on_grouping_element_inside_collection_projection(b
});
});

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Collection_projection_over_GroupBy_over_parameter(bool async)
{
var validIds = new List<string> { "L1 01", "L1 02" };

return AssertQuery(
async,
ss => ss.Set<Level1>()
.Where(l1 => validIds.Contains(l1.Name))
.GroupBy(l => l.Date)
.Select(g => new { g.Key, Ids = g.Select(e => e.Id) }),
elementSorter: e => e.Key,
elementAsserter: (e, a) =>
{
AssertEqual(e.Key, a.Key);
AssertCollection(e.Ids, a.Ids);
});
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task SelectMany_over_conditional_null_source(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2319,6 +2319,28 @@ FROM [LevelOne] AS [l1]
""");
}

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

AssertSql(
"""
SELECT [t].[Date], [t0].[Id]
FROM (
SELECT [l].[Date]
FROM [LevelOne] AS [l]
WHERE [l].[Name] IN (N'L1 01', N'L1 02')
GROUP BY [l].[Date]
) AS [t]
LEFT JOIN (
SELECT [l0].[Id], [l0].[Date]
FROM [LevelOne] AS [l0]
WHERE [l0].[Name] IN (N'L1 01', N'L1 02')
) AS [t0] ON [t].[Date] = [t0].[Date]
ORDER BY [t].[Date]
""");
}

public override async Task Include_partially_added_before_Where_and_then_build_upon(bool async)
{
await base.Include_partially_added_before_Where_and_then_build_upon(async);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3003,6 +3003,28 @@ FROM [Level1] AS [l1]
""");
}

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

AssertSql(
"""
SELECT [t].[Date], [t0].[Id]
FROM (
SELECT [l].[Date]
FROM [Level1] AS [l]
WHERE [l].[Name] IN (N'L1 01', N'L1 02')
GROUP BY [l].[Date]
) AS [t]
LEFT JOIN (
SELECT [l0].[Id], [l0].[Date]
FROM [Level1] AS [l0]
WHERE [l0].[Name] IN (N'L1 01', N'L1 02')
) AS [t0] ON [t].[Date] = [t0].[Date]
ORDER BY [t].[Date]
""");
}

public override async Task Filtered_include_is_considered_loaded(bool async)
{
await base.Filtered_include_is_considered_loaded(async);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3728,6 +3728,36 @@ FROM [LevelOne] AS [l1]
""");
}

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

AssertSql(
"""
SELECT [l].[Date]
FROM [LevelOne] AS [l]
WHERE [l].[Name] IN (N'L1 01', N'L1 02')
GROUP BY [l].[Date]
ORDER BY [l].[Date]
""",
//
"""
SELECT [t0].[Id], [t].[Date]
FROM (
SELECT [l].[Date]
FROM [LevelOne] AS [l]
WHERE [l].[Name] IN (N'L1 01', N'L1 02')
GROUP BY [l].[Date]
) AS [t]
INNER JOIN (
SELECT [l0].[Id], [l0].[Date]
FROM [LevelOne] AS [l0]
WHERE [l0].[Name] IN (N'L1 01', N'L1 02')
) AS [t0] ON [t].[Date] = [t0].[Date]
ORDER BY [t].[Date]
""");
}

public override async Task Include_partially_added_before_Where_and_then_build_upon(bool async)
{
await base.Include_partially_added_before_Where_and_then_build_upon(async);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,28 @@ LEFT JOIN (
""");
}

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

AssertSql(
"""
SELECT [t].[Date], [t0].[Id]
FROM (
SELECT [l].[Date]
FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l]
WHERE [l].[Name] IN (N'L1 01', N'L1 02')
GROUP BY [l].[Date]
) AS [t]
LEFT JOIN (
SELECT [l0].[Id], [l0].[Date]
FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0]
WHERE [l0].[Name] IN (N'L1 01', N'L1 02')
) AS [t0] ON [t].[Date] = [t0].[Date]
ORDER BY [t].[Date]
""");
}

public override async Task Multiple_SelectMany_navigation_property_followed_by_select_collection_navigation(bool async)
{
await base.Multiple_SelectMany_navigation_property_followed_by_select_collection_navigation(async);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3021,6 +3021,28 @@ LEFT JOIN (
""");
}

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

AssertSql(
"""
SELECT [t].[Date], [t0].[Id]
FROM (
SELECT [l].[Date]
FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l]
WHERE [l].[Name] IN (N'L1 01', N'L1 02')
GROUP BY [l].[Date]
) AS [t]
LEFT JOIN (
SELECT [l0].[Id], [l0].[Date]
FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0]
WHERE [l0].[Name] IN (N'L1 01', N'L1 02')
) AS [t0] ON [t].[Date] = [t0].[Date]
ORDER BY [t].[Date]
""");
}

public override async Task Skip_Take_on_grouping_element_into_non_entity(bool async)
{
await base.Skip_Take_on_grouping_element_into_non_entity(async);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.2" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.2" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.2" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_sqlite3" Version="2.1.2" />
<PackageReference Include="SQLitePCLRaw.bundle_sqlite3" Version="2.1.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_winsqlite3" Version="2.1.2" />
<PackageReference Include="SQLitePCLRaw.bundle_winsqlite3" Version="2.1.4" />
</ItemGroup>

</Project>

0 comments on commit c5072f2

Please sign in to comment.