Skip to content

Conversation

@matthewtoghill
Copy link
Collaborator

@matthewtoghill matthewtoghill commented Dec 1, 2025

Description

Upgrade the solution to .NET 10.

  • chore: Packages updated
  • fix: Breaking changes resolved with:
    • MockQueryable - API change related to AsQueryable()
    • Swashbuckle & Microsoft.OpenApi - API changes related to upgrading the OpenApi version
  • fix: remove [FromFile] annotation on endpoint IFormFile parameter
  • feat: make use of new unbound generic type support for nameof
  • feat: move common MSBuild properties to Directory.Build.props file

Related Issue

Closes #101

How Has This Been Tested?

Tests pass
Test apps created from template created successfully, build and run as expected

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@socket-security
Copy link

socket-security bot commented Dec 1, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedskiasharp@​3.119.0 ⏵ 3.119.181 -110090100100
Addedscalar.aspnetcore@​2.11.610010090100100
Updatedxunit.runner.visualstudio@​3.1.4 ⏵ 3.1.59610090100100
Updatedskiasharp.nativeassets.linux.nodependencies@​3.119.0 ⏵ 3.119.1961009010070
Updatedazure.storage.blobs@​12.25.0 ⏵ 12.26.095 +210090100100
Updatedawesomeassertions@​9.1.0 ⏵ 9.3.09610090100100
Updatedserilog.sinks.console@​6.0.0 ⏵ 6.1.194 -210090100100
Updatedmicrosoft.net.test.sdk@​17.14.1 ⏵ 18.0.110010090100100
Updatedserilog.sinks.applicationinsights@​4.0.0 ⏵ 4.1.09810090100100
Updatedlinqkit.microsoft.entityframeworkcore@​9.0.8 ⏵ 10.0.9100 +310090 +2100100
Updateddelegatedecompiler.entityframeworkcore5@​0.34.2 ⏵ 0.35.310010090100100
Updatedkeycloak.net.core@​1.0.34 ⏵ 1.0.389910090100100
Updatedmockqueryable.moq@​7.0.4-beta ⏵ 10.0.1100 +110090100100
Updatedpolly.extensions@​8.6.3 ⏵ 8.6.59410090100100
Updatedpolly.core@​8.6.3 ⏵ 8.6.59810090100100
Updatedtestcontainers@​4.6.0 ⏵ 4.9.09510090100100
Updatedtestcontainers.mssql@​4.6.0 ⏵ 4.9.09710090100100
Updatedtestcontainers.rabbitmq@​4.6.0 ⏵ 4.9.09910090100100
Updatedtestcontainers.keycloak@​4.6.0 ⏵ 4.9.09910090100100
Updatedtestcontainers.azurite@​4.6.0 ⏵ 4.9.09910090100100
Updatedserilog.settings.configuration@​9.0.0 ⏵ 10.0.09610090100100
Updatedserilog.extensions.hosting@​9.0.0 ⏵ 10.0.09610090100100
Updatedserilog.aspnetcore@​9.0.0 ⏵ 10.0.09810090100100
Updatedmasstransit@​8.5.2 ⏵ 8.5.794 +110090 +2100100
Updatedmasstransit.rabbitmq@​8.5.2 ⏵ 8.5.79510090100100
Updatedmasstransit.azure.servicebus.core@​8.5.2 ⏵ 8.5.795 +110090 +2100100
Updatedmasstransit.entityframeworkcore@​8.5.2 ⏵ 8.5.799 +110090 +2100100
Updatedfluentvalidation@​12.0.0 ⏵ 12.1.110010090100100
Updatedfluentvalidation.dependencyinjectionextensions@​12.0.0 ⏵ 12.1.110010090100100
Updatedmicrosoft.extensions.diagnostics.healthchecks.entityframeworkcore@​9.0.8 ⏵ 10.0.1100 +110090100100
Updatedmicrosoft.aspnetcore.authentication.jwtbearer@​9.0.8 ⏵ 10.0.110010090100100
Updatedmicrosoft.extensions.hosting@​9.0.8 ⏵ 10.0.196 +11009010090 -9
See 9 more rows in the dashboard

View full report

@CesarD CesarD self-requested a review December 2, 2025 02:00
matthewtoghill and others added 6 commits December 3, 2025 11:10
…er small refactors to update the current code with the most recent language features.
Added CompatibilityLevel configuration to EF Core configuration for most recent features usages.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we've upgraded to .NET10 in this PR, we need to decide if we want to continue to keep a .sln file for compatibility or if it's possible to remove it and just have the new .slnx file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I believe we can get rid of the .sln file for good 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the .sln file but I think the templating has not fixed the issue with XML conditional processing in .slnx files. We have a solution to that though so it is not a problem.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, what problem was it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Within the .slnx file we have the <!--#if --> blocks. These were not being processed in the expected way for this file type when we first added the .slnx file. We have a SpecialCustomOperations item in the template.json file that deals with handling these blocks in the .slnx file.

I've not tested if the templating has been updated more recently to fix the issue on their end that would mean the SpecialCustomOperations item for the .slnx file is no longer needed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now I get it... I would have expected that the .slnx would behave like any other XML file and that they would have prepared the templating engine accordingly... Isn't there any information about this for the templating engine?

@CesarD
Copy link
Collaborator

CesarD commented Dec 10, 2025

@matthewtoghill please check the latest changes out... I've replaced the Swashbuckle implementation for Swagger with Scalar and also included the document and operation transformers for the API security so everything can work pretty similar to how it was with Swashbuckle, but without all the custom code for fixing its issues.
Feel free to give it a try and check out the different scenarios. It should exclude the security transformations if Auth flag is disabled.

@matthewtoghill
Copy link
Collaborator Author

@matthewtoghill please check the latest changes out... I've replaced the Swashbuckle implementation for Swagger with Scalar and also included the document and operation transformers for the API security so everything can work pretty similar to how it was with Swashbuckle, but without all the custom code for fixing its issues. Feel free to give it a try and check out the different scenarios. It should exclude the security transformations if Auth flag is disabled.

Looks good, there was an old issue related to the auth flag being false that is now fixed, or it can be fixed another way if you prefer. When auth or apiService flags are false then the IntegrationTest base class does not include the RequiresAuthentication property.

EntityTypeConfiguration now uses ValueGeneratedNever for IDs, shifting ID generation from the database to the application (via Guid.NewGuid()). Updated entity constructors, command handlers, and tests to align with this approach. Adjusted EF Core migrations and model snapshots to remove ValueGeneratedOnAdd. Cleaned up related test and factory code for consistency.
}

var requiredScopes = metadata.OfType<IAuthorizeData>()
.Where(a => !string.IsNullOrEmpty(a.Policy))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to use string.IsNullOrWhiteSpace?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Refactored MediatorExtensions to support CancellationToken in all methods, improving async and cancellation handling. Introduced CreatedResponse record for standardized creation responses. Updated Companies, Products, and Files endpoints to use new Mediator methods and return Created<CreatedResponse>. Adjusted integration tests to validate CreatedResponse. Improved code clarity and authorization policy checks.
@CesarD
Copy link
Collaborator

CesarD commented Dec 28, 2025

@matthewtoghill please review the latest changes I introduced.
Basically, I refactored a little bit the MediatR extensions we had to improve a little bit their naming and also to include the CancellationToken in the async calls being made. I also included a couple more methods for simplifying how to return other types of responses from the endpoint in case of success.

Lastly, please be kind to let me know if you find any issue when running the whole tests battery (including the Integration ones in the same process)... I experienced an issue with the CreateProduct one, where the assertion checking if the ProductCreated message has been consumed is failing, but when I run it individually it succeeds, so I'm not sure if it's my crappy laptop or what, so if you could run it and let me know, that would be great!

Thanks! Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEATURE: Upgrade to .NET 10

2 participants