Skip to content

Commit 67e10a0

Browse files
authored
Merge pull request #96 from koenbeuk/dotnet8
Updated to dotnet 8
2 parents c00dd09 + d1713f0 commit 67e10a0

File tree

32 files changed

+221
-477
lines changed

32 files changed

+221
-477
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Setup .NET
3030
uses: actions/setup-dotnet@v1
3131
with:
32-
dotnet-version: 7.0.x
32+
dotnet-version: 8.0.x
3333
- name: Restore dependencies
3434
run: dotnet restore
3535
- name: Build
@@ -49,7 +49,7 @@ jobs:
4949
dotnet-version: 7.0.x
5050
- name: Pack
5151
run: |
52-
dotnet pack -v normal -c Debug --include-symbols --include-source -p:PackageVersion=2.0.0-pre-$GITHUB_RUN_ID -o nupkg
52+
dotnet pack -v normal -c Debug --include-symbols --include-source -p:PackageVersion=4.0.0-pre-$GITHUB_RUN_ID -o nupkg
5353
- name: Push to GitHub Feed
5454
run: |
5555
for f in ./nupkg/*.nupkg

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Setup .NET Core
2727
uses: actions/setup-dotnet@v1
2828
with:
29-
dotnet-version: 7.0.x
29+
dotnet-version: 8.0.x
3030
include-prerelease: True
3131
- name: Create Release NuGet package
3232
run: |

Directory.Build.props

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,21 @@
11
<Project>
2-
3-
<PropertyGroup>
4-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
5-
<LangVersion>11.0</LangVersion>
6-
<Nullable>enable</Nullable>
7-
<EnableNETAnalyzers>true</EnableNETAnalyzers>
8-
<NoWarn>CS1591</NoWarn>
9-
</PropertyGroup>
10-
11-
<PropertyGroup>
12-
<Authors>Koen Bekkenutte</Authors>
13-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
14-
<PackageProjectUrl>https://github.com/koenbeuk/EntityFrameworkCore.Projectables</PackageProjectUrl>
15-
<RepositoryUrl>https://github.com/koenbeuk/EntityFrameworkCore.Projectables.git</RepositoryUrl>
16-
<RepositoryType>git</RepositoryType>
17-
<PackageReleaseNotes>https://github.com/koenbeuk/EntityFrameworkCore.Projectables/releases</PackageReleaseNotes>
18-
<Description>Project over properties and functions in your linq queries</Description>
19-
</PropertyGroup>
20-
212
<PropertyGroup>
22-
<MicrosoftCodeAnalysisVersion>4.0.1</MicrosoftCodeAnalysisVersion>
3+
<TargetFramework>net8.0</TargetFramework>
4+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
5+
<LangVersion>12.0</LangVersion>
6+
<Nullable>enable</Nullable>
7+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
8+
<NoWarn>CS1591</NoWarn>
9+
<ImplicitUsings>enable</ImplicitUsings>
2310
</PropertyGroup>
2411

2512
<PropertyGroup>
26-
<TargetFrameworkVersion>net7.0;net6.0</TargetFrameworkVersion>
27-
<MicrosoftExtensionsVersion>6.0.0</MicrosoftExtensionsVersion>
28-
<EFCoreVersion>6.0.0</EFCoreVersion>
29-
<TestEFCoreVersion>$(EFCoreVersion)</TestEFCoreVersion>
13+
<Authors>Koen Bekkenutte</Authors>
14+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
15+
<PackageProjectUrl>https://github.com/koenbeuk/EntityFrameworkCore.Projectables</PackageProjectUrl>
16+
<RepositoryUrl>https://github.com/koenbeuk/EntityFrameworkCore.Projectables.git</RepositoryUrl>
17+
<RepositoryType>git</RepositoryType>
18+
<PackageReleaseNotes>https://github.com/koenbeuk/EntityFrameworkCore.Projectables/releases</PackageReleaseNotes>
19+
<Description>Project over properties and functions in your linq queries</Description>
3020
</PropertyGroup>
31-
32-
<PropertyGroup Condition="'$(TargetFramework)' == 'net7.0'">
33-
<EFCoreVersion>7.0.0</EFCoreVersion>
34-
<TestEFCoreVersion>$(EFCoreVersion)</TestEFCoreVersion>
35-
</PropertyGroup>
36-
3721
</Project>

Directory.Packages.props

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.4.5" />
7+
<PackageVersion Include="BenchmarkDotNet" Version="0.13.2" />
8+
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
9+
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
10+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
11+
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
12+
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
13+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
14+
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
15+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
16+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
17+
<PackageVersion Include="ScenarioTests.XUnit" Version="1.0.1" />
18+
<PackageVersion Include="Verify.Xunit" Version="22.5.0" />
19+
<PackageVersion Include="xunit" Version="2.6.2" />
20+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
21+
</ItemGroup>
22+
</Project>

EntityFrameworkCore.Projectables.sln

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
44
VisualStudioVersion = 17.0.31710.8
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A43F1828-D9B6-40F7-82B6-CA0070843E2F}"
7+
ProjectSection(SolutionItems) = preProject
8+
src\Directory.Build.props = src\Directory.Build.props
9+
EndProjectSection
710
EndProject
811
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{F5E4436F-87F2-46AB-A9EB-59B4BF21BF7A}"
912
EndProject
@@ -21,8 +24,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Project
2124
EndProject
2225
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{07584D01-2D30-404B-B0D1-32080C0CC18A}"
2326
EndProject
24-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicSample", "samples\BasicSample\BasicSample.csproj", "{1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}"
25-
EndProject
2627
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projectables.Abstractions", "src\EntityFrameworkCore.Projectables.Abstractions\EntityFrameworkCore.Projectables.Abstractions.csproj", "{C8038180-36F8-4077-922B-91F428EAC7D9}"
2728
EndProject
2829
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projectables.Tests", "tests\EntityFrameworkCore.Projectables.Tests\EntityFrameworkCore.Projectables.Tests.csproj", "{2F0DD7D7-867F-4478-9E22-45C114B61C46}"
@@ -53,10 +54,6 @@ Global
5354
{EE4D6CC1-78DE-4279-A567-C3D360C479F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
5455
{EE4D6CC1-78DE-4279-A567-C3D360C479F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
5556
{EE4D6CC1-78DE-4279-A567-C3D360C479F8}.Release|Any CPU.Build.0 = Release|Any CPU
56-
{1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57-
{1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
58-
{1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
59-
{1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.Release|Any CPU.Build.0 = Release|Any CPU
6057
{C8038180-36F8-4077-922B-91F428EAC7D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
6158
{C8038180-36F8-4077-922B-91F428EAC7D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
6259
{C8038180-36F8-4077-922B-91F428EAC7D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -85,7 +82,6 @@ Global
8582
{698E3EEC-64F9-4F96-B700-D61D04FD0704} = {A43F1828-D9B6-40F7-82B6-CA0070843E2F}
8683
{20F85652-2923-4211-9262-C64BA8C9ED89} = {F5E4436F-87F2-46AB-A9EB-59B4BF21BF7A}
8784
{EE4D6CC1-78DE-4279-A567-C3D360C479F8} = {A43F1828-D9B6-40F7-82B6-CA0070843E2F}
88-
{1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9} = {07584D01-2D30-404B-B0D1-32080C0CC18A}
8985
{C8038180-36F8-4077-922B-91F428EAC7D9} = {A43F1828-D9B6-40F7-82B6-CA0070843E2F}
9086
{2F0DD7D7-867F-4478-9E22-45C114B61C46} = {F5E4436F-87F2-46AB-A9EB-59B4BF21BF7A}
9187
{A36F5471-0C16-4453-811B-818326931313} = {F5E4436F-87F2-46AB-A9EB-59B4BF21BF7A}

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# EntitiyFrameworkCore.Projectables
2-
Flexible projection magic for EFCore
2+
Flexible projection magic for EF Core
33

44
[![NuGet version (EntityFrameworkCore.Projectables)](https://img.shields.io/nuget/v/EntityFrameworkCore.Projectables.Abstractions.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projectables.Abstractions/)
55
[![.NET](https://github.com/koenbeuk/EntityFrameworkCore.Projectables/actions/workflows/build.yml/badge.svg)](https://github.com/koenbeuk/EntityFrameworkCore.Projectables/actions/workflows/build.yml)
@@ -13,9 +13,9 @@ Flexible projection magic for EFCore
1313

1414
## Getting started
1515
1. Install the package from [NuGet](https://www.nuget.org/packages/EntityFrameworkCore.Projectables/)
16-
2. Enable Projectables in your DbContext by calling: `dbContextOptions.UseProjectables()`
17-
3. Implement projectable properties and methods and mark them with the `[Projectable]` attribute.
18-
4. View our [samples](https://github.com/koenbeuk/EntityFrameworkCore.Projectables/tree/master/samples) and checkout our [Blog Post](https://onthedrift.com/posts/efcore-projectables/)
16+
2. Enable Projectables in your DbContext by adding: `dbContextOptions.UseProjectables()`
17+
3. Implement projectable properties and methods, marking them with the `[Projectable]` attribute.
18+
4. Explore our [samples](https://github.com/koenbeuk/EntityFrameworkCore.Projectables/tree/master/samples) and checkout our [Blog Post](https://onthedrift.com/posts/efcore-projectables/) for further guidance.
1919

2020
### Example
2121
Assuming this sample:
@@ -64,38 +64,38 @@ SELECT (
6464
WHERE (
6565
SELECT TOP(1) [o0].[Id]
6666
FROM [Orders] AS [o0]
67-
WHERE ([u].[Id] = [o0].[UserId]) AND [o0].[FulfilledDate] IS NOT NULL
68-
ORDER BY [o0].[CreatedDate] DESC) IS NOT NULL AND ((
67+
WHERE [u].[Id] = [o0].[UserId] AND [o0].[FulfilledDate] IS NOT NULL
68+
ORDER BY [o0].[CreatedDate] DESC) IS NOT NULL AND (
6969
SELECT TOP(1) [o1].[Id]
7070
FROM [Orders] AS [o1]
71-
WHERE ([u].[Id] = [o1].[UserId]) AND [o1].[FulfilledDate] IS NOT NULL
72-
ORDER BY [o1].[CreatedDate] DESC) = [o].[OrderId])) * (
71+
WHERE [u].[Id] = [o1].[UserId] AND [o1].[FulfilledDate] IS NOT NULL
72+
ORDER BY [o1].[CreatedDate] DESC) = [o].[OrderId]) * (
7373
SELECT TOP(1) [o2].[TaxRate]
7474
FROM [Orders] AS [o2]
75-
WHERE ([u].[Id] = [o2].[UserId]) AND [o2].[FulfilledDate] IS NOT NULL
75+
WHERE [u].[Id] = [o2].[UserId] AND [o2].[FulfilledDate] IS NOT NULL
7676
ORDER BY [o2].[CreatedDate] DESC) AS [GrandTotal]
7777
FROM [Users] AS [u]
7878
WHERE [u].[UserName] = @__sampleUser_UserName_0
7979
```
8080

81-
Projectable properties and methods have been inlined! the generated SQL could be improved but this is what EFCore (v5) gives us.
81+
Projectable properties and methods have been inlined! the generated SQL could be improved but this is what EF Core (v8) gives us.
8282

8383
### How it works
84-
Essentially there are 2 components: We have a source generator that is able to write companion Expression for properties and methods marked with the `Projectable` attribute. We then have a runtime component that intercepts any query and translates any call to a property or method marked with the `Projectable` attribute and translates the query to use the generated Expression instead.
84+
Essentially, there are two components: We have a source generator that can write companion expressions for properties and methods marked with the Projectable attribute. Then, we have a runtime component that intercepts any query and translates any call to a property or method marked with the Projectable attribute, translating the query to use the generated expression instead.
8585

8686
### FAQ
8787

8888
#### Are there currently any known limitations?
89-
There is currently no support for overloaded methods. Each method name needs to be unique within a given type.
89+
Currently, there is no support for overloaded methods. Each method name needs to be unique within a given type.
9090

9191
#### Is this specific to a database provider?
92-
No; The runtime component injects itself within the EFCore query compilation pipeline and thus has no impact on the database provider used. Of course you're still limited to whatever your database provider can do.
92+
No, the runtime component injects itself into the EFCore query compilation pipeline, thus having no impact on the database provider used. Of course, you're still limited to whatever your database provider can do.
9393

9494
#### Are there performance implications that I should be aware of?
95-
There are 2 compatibility modes: Limited and Full (Default). Most of the time, limited compatibility mode is sufficient however if you are running into issues with failed query compilation, then you may want to stick with Full compatibility mode. With Full compatibility mode, Each Query will first be expanded (Any calls to Projectable properties and methods will be replaced by their respective Expression) before being handed off to EFCore. (This is similar to how LinqKit/LinqExpander/Expressionify works). Because of this additional step, there is a small performance impact. Limited compatibility mode is smart about things and only expands the Query after it has been accepted by EF. The expanded query will then be stored in the Query Cache. With Limited compatibility you will likely see [increased](https://onthedrift.com/posts/efcore-projectables-perf/) performance over EFCore without projectables.
95+
There are two compatibility modes: Limited and Full (Default). Most of the time, limited compatibility mode is sufficient. However, if you are running into issues with failed query compilation, then you may want to stick with Full compatibility mode. With Full compatibility mode, each query will first be expanded (any calls to Projectable properties and methods will be replaced by their respective expression) before being handed off to EFCore. (This is similar to how LinqKit/LinqExpander/Expressionify works.) Because of this additional step, there is a small performance impact. Limited compatibility mode is smart about things and only expands the query after it has been accepted by EF. The expanded query will then be stored in the Query Cache. With Limited compatibility, you will likely see increased performance over EFCore without projectables.
9696

9797
#### Can I call additional properties and methods from my Projectable properties and methods?
98-
Yes you can! Any projectable property/method can call into other properties and methods as long as those properties/methods are native to EFCore or as long as they are marked with a `Projectable` attribute.
98+
Yes, you can! Any projectable property/method can call into other properties and methods as long as those properties/methods are native to EFCore or marked with a Projectable attribute.
9999

100100
#### Can I use projectable extensions methods on non-entity types?
101101
Yes you can. It's perfectly acceptable to have the following code:
@@ -160,13 +160,13 @@ ORDER BY (COALESCE("u"."FirstName", '') || ' ') || COALESCE("u"."LastName", '')
160160
```
161161

162162
#### How does this relate to [Expressionify](https://github.com/ClaveConsulting/Expressionify)?
163-
Expressionify is a project that was launched before this project. It has some overlapping features and uses similar approaches. When I first published this project, I was not aware of its existence so shame on me. Currently Expressionify targets a more focusses scope of what this project is doing and thereby it seems to be more limiting in its capabilities. Check them out though!
163+
Expressionify is a project that was launched before this project. It has some overlapping features and uses similar approaches. When I first published this project, I was not aware of its existence, so shame on me. Currently, Expressionify targets a more focused scope of what this project is doing, and thereby it seems to be more limiting in its capabilities. Check them out though!
164164

165165
#### How does this relate to LinqKit/LinqExpander/...?
166-
There are a few projects like [LinqKit](https://github.com/scottksmith95/LINQKit) that were created before we had code generators in dotnet. These are great options if you're stuck with classical EF or don't want to rely on code generation. Otherwise I would suggest that EntityFrameworkCore.Projectables and Expresssionify are superior approaches as they are able to rely on SourceGenerators to do most of the hard work.
166+
There are a few projects like [LinqKit](https://github.com/scottksmith95/LINQKit) that were created before we had source generators in .NET. These are great options if you're stuck with classical EF or don't want to rely on code generation. Otherwise, I would suggest that EntityFrameworkCore.Projectables and Expressionify are superior approaches as they can rely on SourceGenerators to do most of the hard work.
167167

168168
#### Is the available for EFCore 3.1, 5 and 6?
169-
Yes it is! there is no difference between any of these versions and you can upgrade/downgrade whenever you want.
169+
V1 is targeting EF Core 5 and 3.1. V2 and V3 are targeting EF Core 6 and are compatible with EF Core 7. You can upgrade/downgrade between these versions based on your EF Core version requirements.
170170

171171
#### What is next for this project?
172-
TBD... However one thing I'd like to improve is our Expression generation logic as its currently making a few assumptions (have yet to experience it breaking). Community contributions are very welcome!
172+
TBD... However, one thing I'd like to improve is our expression generation logic as it's currently making a few assumptions (have yet to experience it breaking). Community contributions are very welcome!
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
6-
<IsPackable>false</IsPackable>
4+
<OutputType>Exe</OutputType>
5+
<IsPackable>false</IsPackable>
76
</PropertyGroup>
87

98
<ItemGroup>
10-
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
11-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
9+
<PackageReference Include="BenchmarkDotNet" />
10+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
1211
</ItemGroup>
1312

1413
<ItemGroup>
15-
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables.Generator\EntityFrameworkCore.Projectables.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
16-
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables\EntityFrameworkCore.Projectables.csproj" />
14+
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables.Generator\EntityFrameworkCore.Projectables.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
15+
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables\EntityFrameworkCore.Projectables.csproj" />
1716
</ItemGroup>
1817

1918
</Project>

samples/BasicSample/BasicSample.csproj

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)