v0.6
v0.6.0
.NET Upgrade
DO now supports .NET 8! Below you can find a task list to upgrade your projects.
- [ ] Upgrade .NET and C# versions
- [ ] in projects
- [ ] in docker files
- [ ] in GitHub workflows
- [ ] Upgrade DO version
- [ ] Syntax improvements
- [ ] Use primary constructors
- [ ] Use collection expressions
- [ ] Use `[FromKeyedServices]` and `[FromServices]` in controllers
Upgrade .NET and C# versions
- Upgrade the project's
C#
language to12
. - Framework version upgrade to
net8.0
in the projects. - Framework and sdk version upgrade to
8
inDockerfile
. - Upgrade dotnet version
8
in Github actions.
Syntax improvements
Primary constructors
Use primary constructor, when there is a dependency that needs to be injected at the constructor without any logic or when the base class constructor is called. Parameter names start with underscore.
public class Entity(IEntityContext<Entity> _context)
{
...
}
Collection expressions
Use new and simplified collection expressions, where possible.
Visit Collection expression for more details.
[FromServices]
in controllers
Instead of using constructor injection, use [FromServices]
attribute to inject
dependencies in controllers.
public Entity Get([FromServices] IQueryContext<Entity> entityQuery) { }
Improvements
ExceptionHandling
now usesMicrosoft.AspNetCore.Diagnostics.IExceptionHandling
ExceptionHandling
feature now addsStatusCodePages
middleware.
- Exceptions now return
ProblemDetails
as response ISystem
is replaced withTimeProvider.System
Mocker
,TheSystem
extension is renamed toTheTime
- Use
FakeTimeProvider
for tests by mockingTheTime
- Internal Server Error response included extra details in message, removed
- Extra details can be reached from the logs
HandledException
is now abstract- Added optional
ExtraDetails
collection property toHandledException
- Added optional
Library Upgrades
Package | Old Version | New Version |
---|---|---|
Microsoft.AspNetCore.Mvc.NewtonsoftJson | 7.0.13 | 8.0.0 |
Microsoft.Extensions.Configuration.Abstractions | 7.0.0 | 8.0.0 |
Microsoft.Extensions.Configuration.Binder | 7.0.0 | 8.0.0 |
Microsoft.Extensions.Logging.Abstractions | 7.0.0 | 8.0.0 |
Microsoft.NET.Test.Sdk | 7.0.0 | 8.0.0 |
Microsoft.Extensions.TimeProvider.Testing | new | 8.0.0 |
Moq | 4.20.69 | 4.20.70 |
NHibernate | 5.4.6 | 5.5.0 |
NUnit | 3.14.0 | 4.0.1 |
StyleCop.Analyzers.Unstable | 1.2.0.507 | 1.2.0.556 |