OData .Net Core 3.1 with Swagger

Object reference not set to an instance of an object. at Microsoft.AspNetCore.Mvc.Routing.ApiVersionMatcherPolicy

I recently upgraded .net core 2.2 web api with Odata and Swagger to 3.1 following Microsoft’s recent endpoint routing support with OData 7.40. All was going great until I realised certain API endpoints were failing with “Object reference not set to an instance of an object. at Microsoft.AspNetCore.Mvc.Routing.ApiVersionMatcherPolicy”. On closer inspection the endpoints failing were all child resources. For example ../api/company/1 works fine ../api/company/1/staff and ../api/company/1/staff/1 were failing with read more

Upgrading .Net Core 2.2 Web API with SWAGGER and ODATA to .Net COre 3.1

Decided to take the plunge and update a fairly sizeable WebAPI with OData and Swagger to .Net Core 3.1. Why the hell would you do this you may ask? Well to take advantage of 3.1’s endpoint routing and OData’s recent support for this with OData 7.40. Inspired by Hassan Habib’s blog entry on Microsoft Dev blogs and decided to go for it. read more

C# Recursive Hierarchy. Get the parent’s children, and their children, and their children, and ……….

The Issue

This one cropped up at work recently. As part of a project there was a requirement for an API to carry out a check as part of an update on an object to ensure that none of the object’s children met a certain criteria (I’m avoiding business context here). read more

How to fix briefly unavailable for scheduled maintenance error in WordPress

Occasionally, on updating a plugin you might see the ‘Briefly unavailable for scheduled maintenance’ message in WordPress. This will be visible even if logged in as Admin. As part of the update process a “.maintenance” file is temporary created in the root folder of WordPress. read more

OData – Create Entity with Child Entities Response with Expand.

The Issue

When creating an entity (with child entities) using POST with OData the response will only show the main Entity created. Child entities are ignored. read more