Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Library of standards implemented to use in ASP.NET Core

License

NotificationsYou must be signed in to change notification settings

marcusturewicz/standards-aspnetcore

Repository files navigation

Standards.AspNetCore logo

Library of standards implemented to use in ASP.NET Core.

CI/CDNugetNuget

For example, it provides convenient abstractions for enforcingDateTime 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 aNuGet package.

Features

IsoDateModelBinder andIsoDateModelBinderProvider

Useful for ensuring consistent Date format contracts in RESTful APIs.IsoDateModelBinder enforcesDateTime model binding with ISO-8601 format (YYYY-MM-DD) in MVC. This can be used in two ways:

  1. In single Controller actions:
[HttpGet]publicIActionResultGet([ModelBinder(typeof(IsoDateModelBinder))]DateTimedate){returnOk("Date is in ISO format");}
  1. Set globally in the application via Startup:
publicoverridevoidConfigureServices(IServiceCollectionservices){services.AddControllers(options=>{options.ModelBinderProviders.Insert(0,newIsoDateModelBinderProvider());})}

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 onlyIsoDateModelBinder is implemented. The intention is for further useful international standards to be implemented in this library.

Contributing

Check out thecontributing page to see the best ways to contribute.

Code of conduct

See theCode of Conduct for the best ways to interact with this project.

License

Standards.AspNetCore is licensed under theMIT license.

About

Library of standards implemented to use in ASP.NET Core

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Languages


[8]ページ先頭

©2009-2025 Movatter.jp