In this post I explain the strategy design pattern and show an example of applying it to import data from different data sources. The strategy pattern is a behavioral design pattern that allows different implementations to be used interchangably at runtime. An application can select the appropriate method to perform a task. The example application lets the user import music data from a csv file source or json file source. Depending on the file type, the import strategy is chosen.
Read More...
In this post, I explain the outbox pattern and implement an example in C#. The outbox pattern can be used when one business transaction needs to happen as a result of another business transaction but it's not possible to combine them into the same database transaction. The example contains two applications. The first allows a user to add titles and authors of books. After a new book is added, a row is created in the outbox. The second application processes the entries in the outbox. The example requires .NET Core 2.1 and SQL Server 2017 express.
Read More...