Just Simply Code

Another developer blog

  • Home
  • About
  • Register
  • Policy

Year: 2019

ASP.Net Core health check – checking external integrated system

14 December 2019 / Leave a Comment

Last post, I showed how to add simple health check for your own system in ASP.Net Core. However, if your system integrates with a third party system, you might want to also check if their system is healthy. ASP.Net Core makes it simple to add more complex health check such as checking external system by … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, Health check

Enable simple ASP.Net Core health check

30 November 2019 / Leave a Comment

I needed to add health check for my Web API in ASP.Net Core. It needs to have an endpoint where it can be pinged to check if my system is healthy. ASP.Net Core has an in-built support for health checks. It can be enabled in the Startup class. Run the application and navigate to the … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, Health check

Strange issue with Copy to Output Directory in Visual Studio

16 November 2019 / Leave a Comment

I need to copy some xsl files to output directory in a folder named XSL when building. I set the Copy to Output Directory setting to Copy if newer on those files. The xsl files get copied correctly to the output folder when I build it locally. However, when deploying and running the code to … [Read more…]

Posted in: Uncategorised Tagged: Build Action

Disable header 100 continue in .Net Core WCF client

2 November 2019 / Leave a Comment

When integrating with the new third party SOAP API, my colleague managed to get it working so we deployed it to test environment. However, it didn’t work on test environment with an invalid response exception. It still worked on my colleague’s computer and a few others. Fortunately, it didn’t work on my computer when I … [Read more…]

Posted in: Uncategorised Tagged: HttpClientHandler, SOAP

Calculating difference between two dates inclusively

19 October 2019 / Leave a Comment

In my current project at work, we have to call a third party API which requires, in the payload, a commencement date and a terminating date. It also requires us to send the difference between those two dates inclusively. For example, – 1 Sep 2019 to 20 Oct 2019 should be 1 month and 20 … [Read more…]

Posted in: Uncategorised Tagged: DateTime

JSON serialize mock object in unit test

6 October 2019 / Leave a Comment

I had to unit test a method that calls a service which returns an interface type. This returned interface is then serialised into JSON string and stored into to some database. This is an example of such method This is the example of the unit test I thought serialising any mock object to JSON should … [Read more…]

Posted in: Uncategorised Tagged: Json Serialisation, Unit Test

Comparing Json strings in unit tests

14 September 2019 / Leave a Comment

There are a couple ways to verify if 2 Json strings are equivalent. Using DeepEquals on JObject There’s a static function DeepEquals on JObject which compares the values of 2 tokens and all their descendant tokens. We can parse the Json strings into JObject and then use this function to compare them. Using FluentAssertions Another … [Read more…]

Posted in: Uncategorised Tagged: Json, Unit Test

NullValueHandling.Ignore is ignored when deserialising Json to anonymous object

31 August 2019 / Leave a Comment

In my project at work, I come across a function where I have to deserialise a Json string to an anonymous object. For Json serialisation in this project, we always use the following Json serialisation settings. I expect the result anonymous object would ignore null properties but they are included. See example below This is … [Read more…]

Posted in: Uncategorised Tagged: Json, Json Deserialisation, Json Serialisation

Merging and replacing 2 Json strings

17 August 2019 / Leave a Comment

Recently at work, I have a requirement to merge two json strings. Basically, I want to achieve what the spread operator does in Javascript.For examples, let’s say we have a json string as below. And we want to merge the below json string The result we want to achieve is as followed After some research, … [Read more…]

Posted in: Uncategorised Tagged: Json

Serialising object to XML with different default namespace and root name

3 August 2019 / Leave a Comment

I have a need to override the default namespace and change the root name when serialising object to XML string. I could add XmlType attribute and change the namespace and add XmlRoot attribute for a different root name. However, we have different clients and each requires different namespace and root name. So I need to … [Read more…]

Posted in: Uncategorised Tagged: Deserialisation, Serialisation, XML
1 2 3 Next »

Search Posts

Recent Posts

  • Override IHttpRequestBodyDetectionFeature.CanHaveBodyOverride value in .NET Core Web API
  • Allow empty request body in PUT and POST HTTP requests in .NET Core Web API
  • Modify request body with middleware in .NET Core Web API
  • Running MS Orleans on AWS ECS
  • Respect leading and trailing spaces when querying SQL Server
Support my blog here!Support my blog!

Archives

  • July 2024
  • June 2024
  • July 2023
  • April 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • October 2017
  • September 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • July 2016
  • June 2016
  • March 2016
  • February 2016
  • January 2016

Copyright © 2025 Just Simply Code.

Me WordPress Theme by themehall.com