Insensitive QueryString value

Recently I got into a situation where I need in the client side the value of a specific parameter in the request’s query string and I need to be sure that I could find the parameter regardless its casing. For that purpose I crate the following function in TypeScript:

1
2
3
4
5
private getInsensitiveQueryStringValue(queryParams: Params, paramKey: string): string {
  const keys = Object.keys(queryParams);
  const key = Array.from(keys).find(item => item.toLowerCase() == paramKey.toLowerCase());
  return key ? queryParams[key] : null;
}

Asynchronous commands

Source code of support available at GitHub

Recently I had to implement a simple application with Windows Presentation Framework (WPF) using Model-View-ViewModel (MVVM) pattern. I got surprised when I noticed that there was not a simple solution out-of-the-box for bind asynchronous commands, so I decided to create my implementations for them.

I also want genericity, so I started defining the most general interface that inheritance from ICommand (included in namespace: “System.Windows.Input”).

Immediate publishing

Source code of support available at GitHub

Once upon a time, a solution hosted in Team Foundation Services (TFS) team project that I downloaded for the first time. I knew that solution build and could be published seamlessly right away. But I got a surprise because both processes failed. Figure 1 shows a simplified project structure.

Project structure

Figure 1: “Project structure”.

Figure 2 shows how the project was configured to generate its documentation:

Generating Swagger/OpenAPI clients

Source code of support available at GitHub

Recently I was developing a .NET Core web application that needs to consume an API developed few years ago using ASP.NET WebAPI. Fortunately, that API have Swagger integrated, so I thought I can save time do not creating manually the instruments required to API calls (DTOs, client, etc.) instead using the “Connected Services” feature of Visual Studio.

I got a big surprise that inspired me to share the experience and the solution in this post. I reproduced a simplified scenario as you can see in figure 1 accessing to Swagger UI through its URL: “http://localhost:5200/swagger”.

Signing assemblies

Source code of support available at GitHub

.NET Core

Not all clients require to sign the assemblies of their applications but when its required, the task is not so easy as you can expect.

In the case of .NET Core applications, we can achieve this just editing the project file (.csproj) adding the following code:

1
2
3
<Target Name="BuildSigning" AfterTargets="AfterBuild">
  <Exec Command="SIGNING_COMMAND" />
</Target>

As example SIGNING_COMMAND could be:

“C\Program Files (x86)\Windows Kits\10\bin\10.0.177630\x64\signtool.exe” sign /f “$(SolutionDir)certificate.pfx” /p “pass&1234” “S(TargetDir).dll”*