This repository demonstrates the use of a custom model binder in an ASP.NET Core application.
- Custom model binding for complex objects.
- Example usage of model binders in controllers.
- Easy-to-follow code structure for learning purposes.
- .NET SDK (version 8.0 or later)
- Basic knowledge of ASP.NET Core.
-
Clone the repository:
git clone https://github.com/your-username/CustomBinderDemo.git cd CustomBinderDemo -
Build the project:
dotnet build
-
Run the application:
dotnet run
-
Use a tool like Postman, Bruno, or
curlto test the custom decimal model binder. Send aGETrequest to the following endpoint:https://localhost:7030/api/test?test=123,45For example, using
curl:curl "https://localhost:7030/api/test?test=123,45"This will trigger the custom model binder that will parse the given number in the query string using the
es-CRculture, which uses the comma as the decimal separator.
- Controllers/: Contains the API controllers.
- ModelBinders/: Custom model binder implementations.
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License.