I’ve written a model binder and a value provider for asp.net core!!!

Okay, context.

I’m had a problem with query string length in my GET requests. They have arrays. Like this:

public class SomeRequest
	public int[] SomeNumbers{ get; set; }

And this led to some really really long query strings


There are often limits to how long a query string can get before stuff breaks. And, besides, this query string is ugly.

Before giving up and switching to POST (so I can use bodies instead), I thought I’d do some things to cut down length. Here’s what my Delimiting Query String Value Provider does:


And here’s what adding my AliasModelBinder to the mix does:


Maximal shortness accomplished.

Okay, maybe renaming SomeNumbers to n is overkill here, but I can think of a lot of other uses for being able to alias variables. Backward compatibility is one. Perhaps you can think of others.

If you have similar problems with long query strings, or would otherwise like to use one of these tools on your project, you can check out my ASP.NET Core model binding repository, and follow links to the nuget packages on nuget.org.