Handling MRNs (Medical Record Numbers) with Compensating Transactions in .NET Core Micro services using the Saga Pattern

Binu S 0 Reputation points

In a hospital management system built with micro services using .NET Core and Entity Framework, how can we ensure data consistency when generating Medical Record Numbers (MRNs)? Since MRNs cannot be deleted, how can we handle situations where a downstream service failure occurs after MRN generation using the Saga pattern with compensating transactions?

A set of technologies in the .NET Framework for building web applications and XML web services.
4,389 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,336 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,631 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 61,416 Reputation points

    you have two options:

    • throw away MRN that get rolled back. This is how sqlserver handles identity column on rollback. the number is never reused.
    • assign the MRN as the last step of the saga.