Working with EF Core across multiple controller services I was receiving the following Entity Framework Core: A second operation started on this context before a previous operation completed. The link for StackOverflow talks about ensuring your dbContext is correctly injected into the ServiceCollection which mine was. A bit of headscratching I was thinking that my foreach loop look fine there was nothing too crazy/costly happening. Then I realised the objects I was looping over hadn’t terminated with a ToList() or similar. Once I added the ToList() the context returned the scope and happy days!
On updating Azure API Management with a new OpenAPI definition file I received the following error: “Azure API Management Template Parameters Used In The UriTemplate Must Be Defined In The Operation, And Vice-Versa”. A fair bit of head-scratching ensued, due to the error message not giving too much away, (which Operation? I’ve 100s of them!) and also being a bit flippant (“vice-versa” <– sass!). Also, I always check that my OpenAPI document conforms and plays nicely with the online Swagger editor. So what gives?
Migrate your home drives to One Drive for Business. A gateway tool to the cloud!
Just following on from my web api/swagger/data .net core 2.2 to 3.1 upgrade and here. I hit another blocker just as everything was going so smoothly!. Basic functional testing on the API was going well until I noticed some POST operations failing with “ERROR The INSERT statement conflicted with the FOREIGN KEY constraint <FK>. The conflict occurred in database “DATABASE”, table “dbo.<tablename>”, column ‘<column name>’. “
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