Skip to content

A humanize model binder for ASP.NET Core. Making dynamic type binding case-insensitive, auto bind single simple type, and more.

Notifications You must be signed in to change notification settings

liamwang/case-insensitive-binder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Case-Insensitive Dynamic Model Binder

This is an ASP.NET Core dynamic model binder which implements binding dynamic type with case-insensitive properties.

Installation

At present the code is pre-release but when ready it will be available on Nuget.

Manual build

If you prefer, you can compile CaseInsensitiveDynamicModelBinder yourself, you'll need:

  • Visual Studio 2015 with Update 3 (or above), or Visual Studio Code.
  • The .NET Core 1.0+ SDK Installed.

To clone it locally click the "Clone or dowload" button above or run the following git commands.

git clone https://github.com/liamwang/CaseInsensitiveDynamicModelBinder.git

Configuration

public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc(options => options.InsertCaseInsensitiveDynamicModelBinder());
}

Use in Controller

[HttpPut]
public IActionResult Put([Insensitive] dynamic data)
{
    string value1 = data.A;
    string value2 = data.a;

    bool b = value1 == value2; // true

    return Ok();
}

Sample Preview

Sample Preview

About

A humanize model binder for ASP.NET Core. Making dynamic type binding case-insensitive, auto bind single simple type, and more.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published