JonPSmith / EfCore.TestSupport

Tools for helping in unit testing applications that use Entity Framework Core
https://www.thereformedprogrammer.net/new-features-for-unit-testing-your-entity-framework-core-5-code/
Other
352 stars 53 forks source link

Dotnet 7 support #54

Closed chrisbbe closed 1 year ago

JonPSmith commented 1 year ago

Hi @chrisbbe,

Thanks for this PR - helps me a lot as I have about 10 libraries to update. I will look at this soon.

Can you tell me a bit more on the Npgsql 7.0 change?

chrisbbe commented 1 year ago

Your welcome,

Npgsql 7.0 has made the Settings property on NpgsqlConnection internal or private, which was used to retrieve the enum property ServerCompatibilityMode in the DropCollations() method.

To retrieve the ServerCompatibilityMode property in Npgsql7.0 i simply initiate a new instance of NpgsqlConnectionStringBuilder with the connection-string being used and have public access to the enum property from there.

chrisbbe commented 1 year ago

Superb, can you release a new version to NuGet please?

JonPSmith commented 1 year ago

The .NET 7 part of the library has seven errors, so I need to sort these out before I can release the NuGet.

JonPSmith commented 1 year ago

Hi @chrisbbe,

Could you send me a link to the information about the Settings property on NpgsqlConnection. Your change has broken all the versions (.NET 7, NET 7, and netcoreapp3.1) of the NpgsqlDatabaseCleaner and I can't get it back.

Until this is fixed I can't release this.

JonPSmith commented 1 year ago

Hi @chrisbbe,

Not so sure that the NpgsqlConnection setting is the problem - also got a problem with SQL Server. Ignore my last request for now.

JonPSmith commented 1 year ago

Hi @chrisbbe,

I have released version 5.3.0. It wasn't a simple update with changes to logging, but the main problem with the VS2022's xUnit runner which runs all the target frameworks at the same time, which wasn't obvious (Resharper's xUnit runner doesn't do that). This caused problems.

So, your PR code was fine, but I was confused by VS2022's xUnit runner, which also showed up a error in the EnsureClean tests if the test database had entities in it.

Thanks for your help.