7.0.0 #937
commonsensesoftware
started this conversation in
Show and tell
7.0.0
#937
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The official release for .NET 7.0 is finally here. There have been numerous changes between the previews and fixes that occurred in 6.0 so they will all be collated here for your convenience.
Features
The primary feature and enhancement areas include:
Minimal APIs
Non-OData Model Bound Settings
Several OData query settings, such as the allowed properties, can only be configured using Model Bound settings. This information is annotated in the Entity Data Model (EDM). How do you configure this information if you're only using some of OData and don't have an EDM?
The OData API Explorer extensions already support using conventions, but it does not allow you to specify a convention which cannot be mapped to some combination of
ODataQueryOptionSettings
orODataValidationSettings
.ModelBoundSettings
is supported, but mapping custom conventions over it would largely be a duplication of whatODataModelBuilder
already does.The new API Explorer support bridges this gap by creating ad hoc EDM instances on your behalf for the sole purpose of configuring Model Bound settings. This allows you to define configurations you couldn't otherwise without having to use an EDM. You have the choice to use attributes or the
ODataModelBuilder
fluent API for conventions.Consider the following:
For ASP.NET Core, that's it; there is nothing else you need to do. ASP.NET Web API doesn't support DI out-of-the-box, so you'll need the following basic setup:
Both platforms support adding, removing, or using conventions. The result of this configuration will show the
$filter
query option and indicate only theauthor
andpublished
properties can be used. If you prefer not to use attributes, the convention-based API can be used as well:The ad hoc EDM is only available during API exploration and is then discarded. It does not opt into any OData features.
ASP.NET Web API
ApiVersioningOptions.UnsupportedApiVersionStatusCode
allows specifying a custom HTTP status code400
404
will always be usedASP.NET Web API with OData
ODataApiExplorerOptions.AdHocModelBuilder
to add or configure conventionsASP.NET Core
IProblemDetailsFactory
toIProblemDetails
RouteGroupBuilder
)ApiVersionSetBuilderFactory
as an injectable delegateVersionedEndpointRouteBuilderFactory
as an injectable delegateApiVersioningOptions.UnsupportedApiVersionStatusCode
allows specifying a custom HTTP status code400
404
will always be usedIApiVersionMetadataCollationProvider
serviceASP.NET Core with OData
ODataApiExplorerOptions.AdHocModelBuilder
which is used in the same way asODataApiVersioningOptions.ModelBuilder
Fixes
All Platforms
StackOverflowException
inAdvertiseApiVersionsAttribute
(AdvertiseApiVersionsAttribute causes stackoverflow when enumarated #932)ASP.NET Core
404
over400
when versioning only by URL segment ([OData] /odata/v1/orders() gives 400 Bad Request "Unspecified API version" #911)IApiVersioningBuilder.AddMvc
ensures dependent services are registeredIApiVersioningBuilder.AddApiExplorer
ensures dependent services are registeredCode
extension inProblemDetails
is correctly written in JSON ascode
NewVersionedApi
when usedWithOpenApi
(New WithOpenApi() methods breaks ASP.NET API Versioning #920)ASP.NET Core with OData
Breaking Changes
This is a summary of all breaking changes from the first previews to the final release.
ASP.NET Web API
DefaultApiVersionReporter
constructor addedISunsetPolicyManager
ASP.NET Core
ProblemDetails
implementationIProblemDetailsFactory
has been removed and is supplanted by the built-inIProblemDetailsService
AddProblemDetails()
must be called to addProblemDetails
, which may result in a behavioral changeMapApiGroup
is nowNewVersionedApi
(ASP.NET team recommendation)IVersionedEndpointConventionBuilder
has been removedVersionedEndpointConventionBuilder
has been removedDefaultApiVersionSetBuilderFactory
has been replaced by theApiVersionSetBuilderFactory
delegateIVersionedEndpointConventionBuilder.WithApiVersionSet
now has the signatureTBuilder WithApiVersionSet<TBuilder>(TBuilder, ApiVersionSet) where TBuilder : notnull, IEndpointConventionBuilder
IEnumerable<IApiVersionMetadataCollationProvider>
:ApiVersionMatcherPolicy
DefaultApiVersionDescriptionProvider
GroupedApiVersionDescriptionProvider
DefaultApiVersionReporter
constructor addedISunsetPolicyManager
ApiExplorerOptionsFactory<T>
was changed to:OptionsFactory<T>
Setups
propertyPostConfigures
propertyContributors
Thanks you to all that contributed directly with code, filing issues, and in-depth discussions. In particular, special thanks to:
This discussion was created from the release 7.0.0.
Beta Was this translation helpful? Give feedback.
All reactions