HTTP Client in Dot Net Core

August 25, 2017

In parallel to the Java/Http Client 4 implementation in the previous post, I also needed to do a call from .NET core in C#.

The endpoint here needs a JSON string posting to it, and it returns JSON back. It's particular about the headers passed - the Content-Type needed ...

HTTP Client 4 and a JSON endpoint

August 17, 2017

I need to POST to a HTTPS JSON based service endpoint in Java. I can do this using Http Client 4.

In the following code, SERVICE_ENDPOINT is the full URL to the service, in my case https://" + SERVICE_HOST + "/v2/. The other values should be self explanatory, and are all strings ...

Parse JSON with Jackson

August 17, 2017

I wanted to parse a small JSON response message in Java, using the Jackson library - version 2.4.5.

The code is as follows, where pJsonResponse is the passed in JSON to parse:

ObjectMapper lMapper = new ObjectMapper();
JsonNode lParsedValue;
  lParsedValue = lMapper.readTree(pJsonResponse);
catch (IOException lException)
  throw new RuntimeException ...

Mac, DotNetCore, Postgres

July 29, 2017

I'm having fun trying to get an application that was originally developed on Windows, against SQL Server, running on a Mac against Postgres. It's written in Microsoft's dotnet core, using C# and Entity Framework Core.

The solution has multiple projects inside of it:

  • Salon - contains the web ...

LINQ Reference

July 21, 2017

Find items in list that matching condition

bool lHasAccepted = ItemsList.Any(itm => itm.IsAccepted.HasValue && itm.IsAccepted.Value == true);

Filter and count items in list

int lAcceptedCount = ItemsList.Where(itm => itm.IsAccepted.HasValue && itm.IsAccepted.Value == true).Count();

Convert Type and map

return await this.dbContext.Submissions.Where(sub => sub ...

Tags: linq