Страница:
Custom API Version Format
Страницы
API Documentation
API Explorer Options
API Version Conventions
API Version Reader
API Version Selector
API Versioning Options
API Versioning with OData
Accessing Version Information
Configuring Your Application
Controller Conventions
Custom API Version Format
Custom Attributes
Defining a Service Version
Deprecating a Service Version
Error Responses
Existing Services Quick Start
Existing Services
FAQ
Home
How to Version Your Service
Known Limitations
Migration
New Services Quick Start
OData Batching
OData Model Configurations
OData Model Substitution
OData Protocol Transitions
OData Query Options
OData Versioned Controllers
OData Versioned Metadata
Swashbuckle Integration
Third Party Extensions
Version Advertisement
Version Discovery
Version Format
Version Interleaving
Version Neutral
Version Policies
Versioned Clients
Versioned ODataModelBuilder
Versioning by Header
Versioning by Media Type
Versioning via the Query String
Versioning via the URL Path
1
Custom API Version Format
Chris Martinez редактировал(а) эту страницу 2023-01-08 18:33:21 -08:00
It is now possible to extend or change the provided API version format, but that capability comes with several rules:
- You must extend
ApiVersion
- You must override:
GetHashCode
CompareTo
ToString(string,IFormatProvider)
- You must implement
IApiVersionParser
- It may be possible to extend
ApiVersionParser
depending on your requirements
- It may be possible to extend
You will likely need to extend ApiVersionFormatProvider
or implement a custom IFormatProvider
. Although not strictly required, you may want to implement operator overloads for your custom type to retain functional parity with ApiVersion
. The custom parser will need to be passed to components that accept IApiVersionParser
and/or replace the default implementation registered for dependency injection.
You should consider the impact that a custom API version may have on clients. Your custom format and parsing logic may need to be distributed to them for to use.
- Home
- Quick Starts
- Version Format
- Version Discovery
- Version Policies
- How to Version Your Service
- API Versioning with OData
- Configuring Your Application
- Error Responses
- API Documentation
- Extensions and Customizations
- Known Limitations
- FAQ
- Examples