Eastrall / EntityFrameworkCore.DataEncryption

A plugin for Microsoft.EntityFrameworkCore to add support of encrypted fields using built-in or custom encryption providers.
MIT License
329 stars 55 forks source link

Adding support for EF Core 6 and .Net 6.0 #34

Closed emorell96 closed 2 years ago

emorell96 commented 2 years ago

I've added project references in the .csproj files: src/EntityFrameworkCore.DataEncryption/EntityFrameworkCore.DataEncryption.csproj to allow for multiple target platforms, including .net standard 2.0, .net 5.0 and .net 6.0.

I've done the same on the test/EntityFrameworkCore.DataEncryption.Test/EntityFrameworkCore.DataEncryption.Test.csproj file to allow for them to work with the new version of .net and the new ef core, as well as the previous ones.

After doing these changes, I ran the tests and they all passed with flying colors in both .net 5.0 and .net 6.0. I couldn't test on .net core 3.1 since the tests use features that are not available in c#8.0.

Finally I incremented the version to 3.0.1-dev so that you could after increment to 3.0.1 with the new changes, and once you've looked over the changes and agreed with them, as well made sure that it won't break support for older versions of EF core (which it shouldn't).

image

emorell96 commented 2 years ago

The pipeline is failing because it wants to build using .net 5.0, and the test project targets .net 6.0. image

Build FAILED.

/opt/hostedtoolcache/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(141,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 6.0.  Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0. [/home/vsts/work/1/s/test/EntityFrameworkCore.DataEncryption.Test/EntityFrameworkCore.DataEncryption.Test.csproj]

I've tested it locally on VS 2022 and it passes.

If I change the target version it should also pass it. You are welcome to update the pipeline to try with .net 6.0

Eastrall commented 2 years ago

Hello, thank you for opening a PR to upgrade the library to target both net5 and net6! There is actually a PR openned (#33) to upgrade to net6 only.

The approach of this PR is more suitable since it keeps the support of netstandard2.0 and does not break existing projects. As for the pipeline build, the pipeline needs to be updated. It actually runs with .NET 5 and since the library was targetting only one framework (netstandard2.0) it wouldn't be an issue. https://github.com/Eastrall/EntityFrameworkCore.DataEncryption/blob/master/.azure/pipelines/azure-pipelines.yml#L12

To solve that, you could update the pipeline file and add the -f net5 (or --framework) option to the dotnet build and dotnet test commands.

emorell96 commented 2 years ago

Alright, all tests have passed. I've updated the pipeline to work with net6.0, and the sample project targets now both net5, and net6. I've also fixed the small typo found in #33, might as well do it at the same time without another pr just for a typo.

BlowaXD commented 2 years ago

Hello, tested on our side with .NET 6, Npgsql provider 6.0, fixed IV. Thanks for the update, works well, please merge when you can ❤️