Just Simply Code

Another developer blog

  • Home
  • About
  • Register
  • Policy

Override IHttpRequestBodyDetectionFeature.CanHaveBodyOverride value in .NET Core Web API

21 July 2024 / Leave a Comment

In this post, I showed how to modify the request body to add an additional field using middleware. It would also add a request body if not provided. However, if you send a request without request body, you would get or if the request has Content-Type in the headers but without request body, you would … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, Middleware, Web API

Allow empty request body in PUT and POST HTTP requests in .NET Core Web API

7 July 2024 / Leave a Comment

When you have an API where the body is not optional or nullable like this If a client sends a request to this endpoint without Content-Type and body, they would get this error And if the request has Content-Type in the headers, then this error will be returned If you want to validate whether the … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, Web API

Modify request body with middleware in .NET Core Web API

23 June 2024 / Leave a Comment

In this post, I’m going to modify the request body by adding an additional field to the request body using middleware. The middleware will try to read the current request body, add the additional field and then replace body with the new content. Then we need to register this middleware in the startup class. That’s … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, Middleware, Web API

Running MS Orleans on AWS ECS

9 June 2024 / Leave a Comment

We use MS Orleans framework for one of our projects recently. We host our services on AWS ECS. This creates some problems for us as Orleans silos need to be able to communicate to each other and there would be some networking issues when they try to talk to each other due to multiple docker … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, ECS, Ms Orleans

Respect leading and trailing spaces when querying SQL Server

2 July 2023 / Leave a Comment

In my current project, I have to implement a search functionality where users can provide a search term and the search term is to be matched exactly. This also means that any leading and trailing in the search term must be respected. Let’s say we have these Posts in the database And we initialise the … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, EF Core, SQL

Modify Swagger JSON schema with Schema Filter

16 April 2023 / Leave a Comment

In the previous post, I show how to reliably determine if a property is nullable for a given Type. I needed to do this because the JSON schema produced by Swagger has incorrect nullability. This is the JSON schema produced by Swagger for the Movie class in the previous post. The title should not be … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, Json Schema, Swagger

Determine if a property is nullable reliably from a Type

2 April 2023 / Leave a Comment

In my current project, I need to check, for a given Type, if any of its properties is nullable. Nullable reference types is enabled in this solution so I want the result to show the property is nullable where the ? is appended to the type name. Let’s say we have some sample classes like these I … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, Nullable, Nullable Reference Types, Reflection

Fixing Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: ”object’ does not contain a definition for ‘{Method}”

15 January 2023 / Leave a Comment

We have some shared library code where we have an interface with a method Handle and an abstract class implementing the interface like below. We have many different types of handlers implementing the abstract class, each does different thing, similarly to the following sample code All these handlers are in different project to the web … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, dynamic, Reflection

Fixing “Unchecked runtime.lastError: The message port closed before a response was received” for browser extension

25 December 2022 / Leave a Comment

In this previous post, I showed how to implement a Chrome Browser extension to talk to a native app on user local machine. Recently, we added support for Microsoft Edge browser and published to Microsoft Edge Add-ons store. We then received reports from some testers in the team that the Edge extension does not work … [Read more…]

Posted in: Uncategorised Tagged: Browser extension, Native Messaging

Setting client certificate when registering HttpClient in .NET Core

4 December 2022 / Leave a Comment

In my current project, we have to integrate with a third party API. One of the security requirements is to use mTLS. This means we have to pass the client certificate when sending HTTP requests to the third party. Since we’re using named HttpClient, we can specify the client certificate when registering the HttpClient in … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, HttpClient, mTLS
1 2 … 16 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