Just Simply Code

Another developer blog

  • Home
  • About
  • Register
  • Policy

Year: 2021

Incorrect way to check if two lists are equivalent using LINQ Except()

19 December 2021 / Leave a Comment

I come across a bug where given two list of objects, if they are not equivalent then something will update. The bug was that even though the two lists are not equivalent, nothing was updated in the database. When looking into the code, it was something like this. The SomeObjectComparer is used to determine if … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, Except, LINQ

Adding GraphQL to existing REST API in .NET Core application

5 December 2021 / Leave a Comment

Some of the senior developers in my team have been looking into using GraphQL in the backend API for the UI. It is currently a REST API. The team believes GraphQL will provide a better experience for the frontend developers and could help with some performance. In this post, I’m going to show how we … [Read more…]

Posted in: Uncategorised Tagged: .NET 5, .Net Core, GraphQL

JSON deserialisation exception with Enumerable.Empty

21 November 2021 / Leave a Comment

I came across this exception in the past after upgrading .NET Core 2.2 to 3.0. I didn’t write about it before but recently I saw this exception again in our error logs so I thought I’d write about this and how to solve it. If you have a model like this That Enumerable.Empty<Author>() is to … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, Json, Json Deserialisation

Cartesian Explosion problem in Entity Framework

7 November 2021 / Leave a Comment

In relational databases like SQL, you can load related entities using Joins. In case of one-to-many relationships, this would lead to duplicated data returned. For example, entity Book has one-to-many Comments. If a book has 3 comments, the query below will return 3 rows, one for each comment with duplicate data for the book. Now … [Read more…]

Posted in: Uncategorised Tagged: EF Core, Net Core, Split Queries, SQL

Executing raw SQL query with Entity Framework without using DbSet

24 October 2021 / Leave a Comment

In this previous post, I showed how to execute raw SQL query using EF but it requires the entity to be defined and to be accessible via DbSet. However, there might be times where you just want to execute a raw SQL query to return some arbitrary shape that is not necessarily part of your … [Read more…]

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

Entity Framework EnsureCreated method

10 October 2021 / Leave a Comment

I came across a problem with EnsureCreated() method that broke all the SQL migrations on start up. I have some queries that I wanted to run before the migrations. I thought I should make sure the database exists before I run them. I saw the method DatabaseFacade. EnsureCreated() and decided to use it. This method … [Read more…]

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

Resetting SQL Sequence for multiple test environments

26 September 2021 / Leave a Comment

In the last post, I showed how we use SQL Sequence to achieve sequential number ID in a specific range. As mentioned in the last post, we and each party that we integrate with have a defined range of number to be used as ID and this ID must be unique globally among all the … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, EF Core, Extension Method, SQL, SQL Sequence

Using SQL Sequence

12 September 2021 / Leave a Comment

Recently we have a requirement for one project where the ID for any entities in this project must be within a range of number. In this project, we have to integrate with a number of other external parties. The ID for any entity used in this integration must be unique globally across all the connected … [Read more…]

Posted in: Uncategorised Tagged: EF Core, SQL, SQL Sequence

Insert, update and delete item from a nested collection property in DynamoDB

29 August 2021 / Leave a Comment

In this post, I’m going to show how to insert, update or delete a single item from a nested collection property in DynamoDB. Let’s say we have a document like this. One way (somewhat obvious?) to update, insert or delete a particular book from this document is to retrieve the whole document, mutate the data … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, DynamoDb

Update complex object property in DynamoDb

15 August 2021 / Leave a Comment

In this previous post, I showed how to update a property in a nested object in DynamoDb. In that post, the property was a simple string. In this short post, I’m going to show how to update an object property. Let’s say our DynamoDB document looks like this We can use UpdateItemAsync to update only … [Read more…]

Posted in: Uncategorised Tagged: .Net Core, DynamoDb
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