Skip to content

Commit

Permalink
Added support for EF 9 + updated packages
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelGerr committed Nov 13, 2024
1 parent a4ca3a3 commit 5907025
Show file tree
Hide file tree
Showing 16 changed files with 110 additions and 101 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ jobs:

steps:

- name: install .NET Core 7/8 SDKs
- name: install .NET Core 7/8/9 SDKs
uses: actions/setup-dotnet@v2
with:
include-prerelease: false
dotnet-version: |
7.0.x
8.0.x
9.0.x
- name: .NET info
run: dotnet --info
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<RootNamespace>Thinktecture</RootNamespace>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<LangVersion>13.0</LangVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
26 changes: 13 additions & 13 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<Project>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="CsvHelper" Version="33.0.1" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="JetBrains.Profiler.Api" Version="1.4.3" />
<PackageVersion Include="MessagePack" Version="2.5.187" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.6" />
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
<PackageVersion Include="JetBrains.Profiler.Api" Version="1.4.8" />
<PackageVersion Include="MessagePack" Version="2.5.192" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.7.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.6" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.6" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="xunit" Version="2.8.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.0",
"version": "9.0.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
Expand Down
4 changes: 2 additions & 2 deletions samples/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<Import Condition=" exists('$(ParentPropsFile)') " Project="$(ParentPropsFile)" />

<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<NoWarn>$(NoWarn);CS1591;CA1052;CA1062;CA1303;CA1707;CA1801;CA2000</NoWarn>
<TargetFrameworks>net9.0</TargetFrameworks>
<NoWarn>$(NoWarn);CS1591;CA1052;CA1062;CA1303;CA1707;CA1801;CA2000;NU1903</NoWarn>
<IsPackable>false</IsPackable>
<ImplicitUsings>disable</ImplicitUsings>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" VersionOverride="6.0.31" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" VersionOverride="6.0.36" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Extends Entity Framework Core to support some components from Thinktecture.Runtime.Extensions.</Description>
<PackageTags>common;EntityFrameworkCore</PackageTags>
<DefineConstants>$(DefineConstants);COMPLEX_TYPES</DefineConstants>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Thinktecture.Runtime.Extensions\Thinktecture.Runtime.Extensions.csproj"/>

<Compile Include="..\Thinktecture.Runtime.Extensions.EntityFrameworkCore.Sources\**\*.cs"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational"/>
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Extends Entity Framework Core to support some components from Thinktecture.Runtime.Extensions.</Description>
<PackageTags>common;EntityFrameworkCore</PackageTags>
<DefineConstants>$(DefineConstants);COMPLEX_TYPES</DefineConstants>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Thinktecture.Runtime.Extensions\Thinktecture.Runtime.Extensions.csproj"/>

<Compile Include="..\Thinktecture.Runtime.Extensions.EntityFrameworkCore.Sources\**\*.cs"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" VersionOverride="8.0.11"/>
</ItemGroup>

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

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" VersionOverride="9.0.0-rc.2.24474.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" />
</ItemGroup>

</Project>
49 changes: 25 additions & 24 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<ParentPropsFile>$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))</ParentPropsFile>
</PropertyGroup>
<PropertyGroup>
<ParentPropsFile>$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))</ParentPropsFile>
</PropertyGroup>

<Import Condition=" exists('$(ParentPropsFile)') " Project="$(ParentPropsFile)" />
<Import Condition=" exists('$(ParentPropsFile)') " Project="$(ParentPropsFile)"/>

<PropertyGroup>
<Nullable>disable</Nullable>
<IsPackable>false</IsPackable>
<ImplicitUsings>disable</ImplicitUsings>
<NoWarn>$(NoWarn);CS1591;CA1707</NoWarn>
<RootNamespace>Thinktecture.Runtime.Tests</RootNamespace>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<PropertyGroup>
<Nullable>disable</Nullable>
<IsPackable>false</IsPackable>
<ImplicitUsings>disable</ImplicitUsings>
<NoWarn>$(NoWarn);CS1591;CA1707;NU1903;NETSDK1206;NU1904</NoWarn>
<RootNamespace>Thinktecture.Runtime.Tests</RootNamespace>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="NSubstitute.Analyzers.CSharp" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="FluentAssertions"/>
<PackageReference Include="NSubstitute"/>
<PackageReference Include="NSubstitute.Analyzers.CSharp"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all"/>
</ItemGroup>

<ItemGroup>
<Using Include="FluentAssertions" />
<Using Include="Xunit" />
</ItemGroup>
<ItemGroup>
<Using Include="FluentAssertions"/>
<Using Include="Xunit"/>
</ItemGroup>

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

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" VersionOverride="6.0.31" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" VersionOverride="6.0.36" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);COMPLEX_TYPES</DefineConstants>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Thinktecture.Runtime.Extensions.EntityFrameworkCore8\Thinktecture.Runtime.Extensions.EntityFrameworkCore8.csproj"/>
<ProjectReference Include="..\..\src\Thinktecture.Runtime.Extensions.SourceGenerator\Thinktecture.Runtime.Extensions.SourceGenerator.csproj" SetTargetFramework="TargetFramework=netstandard2.0" ReferenceOutputAssembly="false" OutputItemType="Analyzer"/>
<ProjectReference Include="..\Thinktecture.Runtime.Extensions.Tests.Shared\Thinktecture.Runtime.Extensions.Tests.Shared.csproj"/>
</ItemGroup>

<ItemGroup>
<Compile Include="..\Thinktecture.Runtime.Extensions.EntityFrameworkCore.Tests.Sources\**\*.cs"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);COMPLEX_TYPES</DefineConstants>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Thinktecture.Runtime.Extensions.EntityFrameworkCore8\Thinktecture.Runtime.Extensions.EntityFrameworkCore8.csproj"/>
<ProjectReference Include="..\..\src\Thinktecture.Runtime.Extensions.SourceGenerator\Thinktecture.Runtime.Extensions.SourceGenerator.csproj" SetTargetFramework="TargetFramework=netstandard2.0" ReferenceOutputAssembly="false" OutputItemType="Analyzer"/>
<ProjectReference Include="..\Thinktecture.Runtime.Extensions.Tests.Shared\Thinktecture.Runtime.Extensions.Tests.Shared.csproj"/>
</ItemGroup>

<ItemGroup>
<Compile Include="..\Thinktecture.Runtime.Extensions.EntityFrameworkCore.Tests.Sources\**\*.cs"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" VersionOverride="8.0.11" />
</ItemGroup>

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

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" VersionOverride="9.0.0-rc.2.24474.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,8 @@ public static Dictionary<string, string> GetGeneratedOutputs<T>(string source, p

protected static void AssertOutput(string output, string expectedOutput)
{
if (Environment.NewLine == "\n")
{
output = output?.Replace("\r\n", Environment.NewLine);
expectedOutput = expectedOutput?.Replace("\r\n", Environment.NewLine);
}
output = output?.Replace("\r\n", "\n");
expectedOutput = expectedOutput?.Replace("\r\n", "\n");

output.Should().Be(expectedOutput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ public AnalyzerTest(
ExpectedDiagnostics.AddRange(expected);
#if NET7
ReferenceAssemblies = new ReferenceAssemblies("net7.0", new PackageIdentity("Microsoft.NETCore.App.Ref","7.0.0"), Path.Combine("ref", "7.0.0"));
#else
#elif NET8_0
ReferenceAssemblies = new ReferenceAssemblies("net8.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "8.0.0"), Path.Combine("ref", "8.0.0"));
#else
ReferenceAssemblies = new ReferenceAssemblies("net9.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "9.0.0"), Path.Combine("ref", "9.0.0"));
#endif

foreach (var additionalReference in additionalReferences)
{
TestState.AdditionalReferences.Add(additionalReference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@ public CodeFixTest(
ExpectedDiagnostics.AddRange(expected);
#if NET7
ReferenceAssemblies = new ReferenceAssemblies("net7.0", new PackageIdentity("Microsoft.NETCore.App.Ref","7.0.0"), Path.Combine("ref", "7.0.0"));
#else
#elif NET8_0
ReferenceAssemblies = new ReferenceAssemblies("net8.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "8.0.0"), Path.Combine("ref", "8.0.0"));
#else
ReferenceAssemblies = new ReferenceAssemblies("net9.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "9.0.0"), Path.Combine("ref", "9.0.0"));
#endif

foreach (var additionalReference in additionalReferences)
{
TestState.AdditionalReferences.Add(additionalReference);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using Thinktecture.Runtime.Tests.TestValueObjects;

namespace Thinktecture.Runtime.Tests.ValueObjectTests;
Expand Down Expand Up @@ -68,11 +69,14 @@ public void Properties_with_init_should_be_recognized_as_value_object_properties
var obj = ValueObjectWithInitProperties.Create(initExpression: 1, initBody: 2, publicPropertyDefaultInit: 3, privatePropertyDefaultInit: 4);

obj.Should().BeEquivalentTo(new
{
InitExpression = 1,
InitBody = 2,
PublicPropertyDefaultInit = 3,
PrivatePropertyDefaultInit = 4
});
{
InitExpression = 1,
InitBody = 2,
PublicPropertyDefaultInit = 3
});

obj.GetType().GetProperty("PrivatePropertyDefaultInit", BindingFlags.Instance | BindingFlags.NonPublic)!
.GetValue(obj).Should().BeOfType<int>()
.Subject.Should().Be(4);
}
}

0 comments on commit 5907025

Please sign in to comment.