Standards.AspNetCore
2.0.0
dotnet add package Standards.AspNetCore --version 2.0.0
NuGet\Install-Package Standards.AspNetCore -Version 2.0.0
<PackageReference Include="Standards.AspNetCore" Version="2.0.0" />
paket add Standards.AspNetCore --version 2.0.0
#r "nuget: Standards.AspNetCore, 2.0.0"
// Install Standards.AspNetCore as a Cake Addin #addin nuget:?package=Standards.AspNetCore&version=2.0.0 // Install Standards.AspNetCore as a Cake Tool #tool nuget:?package=Standards.AspNetCore&version=2.0.0
<p align="center"><a href="https://github.com/marcusturewicz/Standards.AspNetCore"><img src="logo.png" alt="Standards.AspNetCore logo"/></a></p>
<p align="center">Library of standards implemented to use in ASP.NET Core.</p>
<div align="center">
</div>
For example, it provides convenient abstractions for enforcing DateTime
objects are binded with ISO-8601 format (YYYY-MM-DD) in MVC.
Compatibility
Standards.AspNetCore currently targets .NET 6+. We follow the .NET Core support policy and therefore support only the LTS versions. When an LTS version goes out of support, we will update the major version of the library, drop support for the previous LTS version, and only target the next LTS version.
Getting Started
Standards.AspNetCore is available as a NuGet package.
Features
IsoDateModelBinder
and IsoDateModelBinderProvider
Useful for ensuring consistent Date format contracts in RESTful APIs. IsoDateModelBinder
enforces DateTime
model binding with ISO-8601 format (YYYY-MM-DD) in MVC. This can be used in two ways:
- In single Controller actions:
[HttpGet]
public IActionResult Get([ModelBinder(typeof(IsoDateModelBinder))] DateTime date) {
return Ok("Date is in ISO format");
}
- Set globally in the application via Startup:
public override void ConfigureServices(IServiceCollection services) {
services.AddControllers(options => {
options.ModelBinderProviders.Insert(0, new IsoDateModelBinderProvider());
})
}
Then, only dates in ISO-8601 format (YYYY-MM-DD) can be binded. For example, /api?date=2021-01-01
will be successfully binded. However, /api?date=01-01-2021
will not, and the following error message will be added to the problem details response:
"Invalid date; must be in ISO-8601 format i.e. YYYY-MM-DD."
Roadmap
Currently only IsoDateModelBinder
is implemented. The intention is for further useful international standards to be implemented in this library.
Contributing
Check out the contributing page to see the best ways to contribute.
Code of conduct
See the Code of Conduct for the best ways to interact with this project.
License
Standards.AspNetCore is licensed under the MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.0 | 334 | 1/1/2023 |
1.0.0 | 497 | 11/13/2021 |
1.0.0-beta.2 | 160 | 9/8/2021 |
1.0.0-beta.1 | 156 | 9/2/2021 |
1.0.0-alpha.5 | 173 | 8/29/2021 |
1.0.0-alpha.4 | 182 | 8/29/2021 |
1.0.0-alpha.3 | 178 | 8/29/2021 |
1.0.0-alpha.2 | 175 | 8/28/2021 |
1.0.0-alpha.1 | 171 | 8/28/2021 |