Skip to content
Open
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
10 changes: 4 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand All @@ -46,9 +44,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x
- name: Pack
run: |
dotnet pack -v normal -c Debug --include-symbols --include-source -p:PackageVersion=4.0.0-pre-$GITHUB_RUN_ID -o nupkg
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x
include-prerelease: True
- name: Create Release NuGet package
run: |
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
Expand Down
9 changes: 8 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.8.3" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net90" Version="1.8.3" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net100" Version="1.8.3" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.7.9" />
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
Expand Down
5 changes: 5 additions & 0 deletions EntityFrameworkCore.Projectables.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
.gitattributes = .gitattributes
.gitignore = .gitignore
global.json = global.json
LICENSE.md = LICENSE.md
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projectables", "src\EntityFrameworkCore.Projectables\EntityFrameworkCore.Projectables.csproj", "{EE4D6CC1-78DE-4279-A567-C3D360C479F8}"
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.100",
"version": "10.0.100",
"rollForward": "latestMinor"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- Override TargetFrameworks with an "s" from Directory.Build.props settings as needed -->
<TargetFrameworks>netstandard2.0;</TargetFrameworks>
<NoWarn>$(NoWarn);NU5128</NoWarn>
<IsPackable>false</IsPackable>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,36 @@ public void ProcessModelFinalizing(
{
foreach (var entityType in modelBuilder.Metadata.GetEntityTypes())
{
#if NET10_0_OR_GREATER
var queryFilter = entityType.GetDeclaredQueryFilters();

foreach (var filter in queryFilter)
{
if (filter.Expression == null)
{
continue;
}

var expandedExpression = filter.Expression.ExpandProjectables() as LambdaExpression;

// Expands query filters
if (filter.Key != null)
{
entityType.SetQueryFilter(filter.Key, expandedExpression);
}
else
{
entityType.SetQueryFilter(expandedExpression);
}
}
#else
var queryFilter = entityType.GetQueryFilter();
if (queryFilter != null)
{
// Expands query filters
entityType.SetQueryFilter(queryFilter.ExpandProjectables() as LambdaExpression);
}
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DECLARE @validArray1 int = 1;
DECLARE @validArray2 int = 2;
DECLARE @validArray3 int = 3;

SELECT [t].[Id]
FROM [TestEntity] AS [t]
WHERE [t].[Id] IN (@validArray1, @validArray2, @validArray3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DECLARE @validList1 int = 1;
DECLARE @validList2 int = 2;
DECLARE @validList3 int = 3;

SELECT [t].[Id]
FROM [TestEntity] AS [t]
WHERE [t].[Id] IN (@validList1, @validList2, @validList3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SELECT [t].[Id]
FROM [TestEntity] AS [t]
WHERE [t].[Id] IN (1, 2, 3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SELECT [o1].[RecordDate]
FROM [User] AS [u]
INNER JOIN (
SELECT [o0].[RecordDate], [o0].[UserId]
FROM (
SELECT [o].[RecordDate], [o].[UserId], ROW_NUMBER() OVER(PARTITION BY [o].[UserId] ORDER BY [o].[RecordDate] DESC) AS [row]
FROM [Order] AS [o]
) AS [o0]
WHERE [o0].[row] <= 2
) AS [o1] ON [u].[Id] = [o1].[UserId]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SELECT [o1].[Id], [o1].[RecordDate], [o1].[UserId]
FROM [User] AS [u]
LEFT JOIN (
SELECT [o0].[Id], [o0].[RecordDate], [o0].[UserId]
FROM (
SELECT [o].[Id], [o].[RecordDate], [o].[UserId], ROW_NUMBER() OVER(PARTITION BY [o].[UserId] ORDER BY [o].[RecordDate] DESC) AS [row]
FROM [Order] AS [o]
) AS [o0]
WHERE [o0].[row] <= 1
) AS [o1] ON [u].[Id] = [o1].[UserId]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT (
SELECT TOP(1) [o].[RecordDate]
FROM [Order] AS [o]
WHERE [u].[Id] = [o].[UserId]
ORDER BY [o].[RecordDate] DESC)
FROM [User] AS [u]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SELECT [o2].[RecordDate]
FROM [User] AS [u]
INNER JOIN (
SELECT [o1].[RecordDate], [o1].[UserId]
FROM (
SELECT [o0].[RecordDate], [o0].[UserId], ROW_NUMBER() OVER(PARTITION BY [o0].[UserId] ORDER BY [o0].[RecordDate] DESC) AS [row]
FROM [Order] AS [o0]
) AS [o1]
WHERE [o1].[row] <= 2
) AS [o2] ON [u].[Id] = [o2].[UserId]
WHERE (
SELECT TOP(1) [o].[Id]
FROM [Order] AS [o]
WHERE [u].[Id] = [o].[UserId]
ORDER BY [o].[RecordDate] DESC) > 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SELECT [o2].[RecordDate]
FROM [User] AS [u]
INNER JOIN (
SELECT [o1].[RecordDate], [o1].[UserId]
FROM (
SELECT [o0].[RecordDate], [o0].[UserId], ROW_NUMBER() OVER(PARTITION BY [o0].[UserId] ORDER BY [o0].[RecordDate] DESC) AS [row]
FROM [Order] AS [o0]
) AS [o1]
WHERE [o1].[row] <= 2
) AS [o2] ON [u].[Id] = [o2].[UserId]
WHERE (
SELECT TOP(1) [o].[Id]
FROM [Order] AS [o]
WHERE [u].[Id] = [o].[UserId]
ORDER BY [o].[RecordDate] DESC) > 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Id] + 2
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SELECT [e1].[Id]
FROM [Entity] AS [e]
OUTER APPLY (
SELECT TOP(1) [e0].[Id]
FROM [Entity] AS [e0]
WHERE [e0].[Id] > [e].[Id]
) AS [e1]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Id] * [e].[Id]
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Id] + 1
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Id] + 1 + 1
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DECLARE @key varchar(11) = 'x';

SELECT [c].[Id]
FROM [ConcreteEntity] AS [c]
WHERE CONVERT(varchar(11), [c].[Id]) = @key
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT CASE
WHEN [e].[Id] >= 0 THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END, [e].[Id], [e].[Name]
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT CAST(1 AS bit), [e].[Id], [e].[Name]
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT CAST([c].[Age] AS float) / [c].[AverageLifespan] AS [LifeProgression], CAST([c].[MentalAge] AS float) / [c].[AverageLifespan] AS [MentalLifeProgression]
FROM [Cat] AS [c]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT 4
FROM [Concrete] AS [c]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT 2
FROM [Concrete] AS [c]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT 2
FROM [Concrete] AS [c]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT 2
FROM [MoreConcrete] AS [m]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT 2
FROM [MoreConcrete] AS [m]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT 2
FROM [Concrete] AS [c]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT 2
FROM [Concrete] AS [c]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SELECT [c].[Id]
FROM [BaseProvider] AS [b]
INNER JOIN [Concrete] AS [c] ON [b].[Id] = [c].[BaseProviderId]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT [e].[Id], [e0].[Id] + 1, [e0].[Id]
FROM [Entity] AS [e]
LEFT JOIN [Entity] AS [e0] ON [e].[Id] = [e0].[EntityId]
ORDER BY [e].[Id]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT 7
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT CAST(LEN([e].[Name]) AS int)
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SELECT [e2].[Id], [e2].[EntityId], [e2].[Name]
FROM [Entity] AS [e]
LEFT JOIN (
SELECT [e1].[Id], [e1].[EntityId], [e1].[Name]
FROM (
SELECT [e0].[Id], [e0].[EntityId], [e0].[Name], ROW_NUMBER() OVER(PARTITION BY [e0].[EntityId] ORDER BY [e0].[Id]) AS [row]
FROM [Entity] AS [e0]
) AS [e1]
WHERE 0 < [e1].[row] AND [e1].[row] <= 1
) AS [e2] ON [e].[Id] = [e2].[EntityId]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Name]
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT CAST(LEN([e].[Name]) AS int)
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SELECT CAST(1 AS bit), [e].[Id], [e0].[Id], [e0].[EntityId], [e0].[Name], [e3].[Id], [e3].[EntityId], [e3].[Name]
FROM [Entity] AS [e]
LEFT JOIN [Entity] AS [e0] ON [e].[Id] = [e0].[EntityId]
LEFT JOIN (
SELECT [e2].[Id], [e2].[EntityId], [e2].[Name]
FROM (
SELECT [e1].[Id], [e1].[EntityId], [e1].[Name], ROW_NUMBER() OVER(PARTITION BY [e1].[EntityId] ORDER BY [e1].[Id]) AS [row]
FROM [Entity] AS [e1]
) AS [e2]
WHERE 0 < [e2].[row] AND [e2].[row] <= 1
) AS [e3] ON [e].[Id] = [e3].[EntityId]
ORDER BY [e].[Id]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Name]
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Id]
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Id], [e].[Id] * 5
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Id]
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Id]
FROM [Entity] AS [e]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT [e].[Id], (
SELECT COUNT(*)
FROM [Entity] AS [e0]
WHERE [e0].[Id] * 5 = 5) AS [TotalCount]
FROM [Entity] AS [e]
WHERE [e].[Id] * 5 = 5
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT [e].[Id], [e].[Id] * 5
FROM [Entity] AS [e]
Loading