Just Simply Code

Another developer blog

  • Home
  • About
  • Register
  • Policy

Uncategorised

Helper method to get enum list with custom ordering

30 March 2019 / Leave a Comment

I have a client generated enum class with values already defined. I have to populate a dropdown list with all the enum values with a different order than the order they are declared in. First, I thought its as simple as just rearranging the order they are declared in to the order I need and … [Read more…]

Posted in: Uncategorised Tagged: Enum, Extension Method

Deserialising XML string without namespaces

16 March 2019 / Leave a Comment

I have a xml string without any namespaces that needs to deserialise to an object that has namespace in XmlType attribute. When I try to deserialise it with XmlSerializer, all my properties are not populated. To fix it, I need to add my own XmlTextReader that will replace it with the namespace from class. I … [Read more…]

Posted in: Uncategorised Tagged: Deserialisation, XML

Highlight differences between 2 HTML strings

2 March 2019 / Leave a Comment

I need to show the differences between 2 HTML documents. I use this library called htmldiff.net to achieve this. First, install htmldiff.net from nuget package manager.Then, you can do the following example to get the new HTML string with the differences highlighted. This is what my example looks like in an MVC app

Posted in: Uncategorised Tagged: html, htmldiff.net

Add Javascript to bottom of body tag from a partial view in MVC

16 February 2019 / Leave a Comment

Usually, when you want to add Javascript to a view in MVC project, you would use It would be put just before the closing body tag (providing you have @RenderSection(“scripts”, required: false) before the closing body tag in the _Layout.cshtml file). However, if you have the need to add Javascript in a partial view, it … [Read more…]

Posted in: Uncategorised Tagged: Javascript, MVC

Ignore specified members field when serialise to Json string

2 February 2019 / Leave a Comment

I have a generated WCF client with class similar to the sample below In my unit test, I instantiate an instance of SampleClass with a value of Cost field but without setting the CostFieldSpecified to true. When I serialise it to Json string, the Cost field’s value is 0 instead of the value I set … [Read more…]

Posted in: Uncategorised Tagged: Json, Json Serialisation, Unit Test

Rewrite SOAP request message before sending

20 January 2019 / Leave a Comment

For debugging purposes, I needed to alter the xml SOAP request completely before sending the request. In this post, I showed how to log all outgoing SOAP request by using IClientMessageInspector. I’d use the same method to alter the request before sending.

Posted in: Uncategorised Tagged: IClientMessageInspector, IEndpointBehavior, Logging, SOAP

Badly auto generated WCF proxy

29 December 2018 / Leave a Comment

I generated a WCF proxy from a WSDL file given by one of our clients using the svcutils with dotnet core 2.1. When call one of the services, I get the following error. System.PlatformNotSupportedException: Compiling JScript/CSharp scripts is not supported After a bit of research and looking into the generated proxy, I found that some … [Read more…]

Posted in: Uncategorised Tagged: WCF

Adding Polly policies

15 December 2018 / Leave a Comment

Polly is a great library allowing us to add policies such as retry, circuit breaker, timeout, etc. to our HttpClient. These are the policies I used in my project and how to add them to HttpClient RetryPolicy This policy is for GET requests. We only want to retry if HTTP status code is request timeout … [Read more…]

Posted in: Uncategorised Tagged: HttpClient, Polly

Installing and getting PFX certificate

1 December 2018 / Leave a Comment

I had to integrate to a SOAP service in my current project which requires installing a PFX certificate. I want to install it in code during start up so that it will just work on other developers’ machines. Here is the implementation of the function that installs the certificate. It requires the path to the … [Read more…]

Posted in: Uncategorised Tagged: Installing Cert, PFX Cert

Get Australian timezone name by state using Noda Time

17 November 2018 / Leave a Comment

In this post I will show how to convert UTC date to local Australian date by state. The result will be in the format of {localDateTime} – {timezone name} ({timezone abbreviation}) e.g “14/10/2018 20:30 – Australian Eastern Standard Time (AEST)” I added this method as an extension on DateTime

Posted in: Uncategorised Tagged: DateTime, Extension Method, Noda Time
« Previous 1 … 9 10 11 … 14 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 © 2026 Just Simply Code.

Me WordPress Theme by themehall.com