C# Garbage Collector - Part 3

This article in the C# garbage collector series outlines the history and types of GC in .NET. It covers three GC modes:

  1. Server GC for server-side applications
  2. Concurrent Workstation GC for client apps with UI
  3. Non-Concurrent Workstation GC for single-processor server apps
Each mode is optimized for different scenarios, balancing throughput and responsiveness. The article provides insights into configuring these modes for specific applications, highlighting the importance of choosing the right GC mode based on the application's nature and environment.

C# Garbage Collector - Part 2

This article delves into the distinction between Stack and Heap in C# memory management. It explains how the stack, with its LIFO method, stores value types like structs and enums, while the heap handles reference types like strings. Key concepts like boxing and unboxing are covered, showing how value types can be converted to reference types and vice versa. The article emphasizes the importance of efficient memory management and the role of the garbage collector in .NET, particularly in managing heap memory and optimizing overall application performance.

C# Garbage Collector - Part 1

This article explores memory management in C# and the garbage collector’s role. It differentiates managed languages like C# from unmanaged ones like C and C++, highlighting C#’s automatic memory management. Using a simple example, the article shows how C# frees developers from the complexities of manual memory allocation and disposal, allowing them to focus more on business logic. The series aims to provide a comprehensive understanding of the garbage collector in C#, demonstrating its efficiency in managing memory in managed programming environments.

C# Internals - Single and SingleOrDefault

This article demystifies the LINQ methods Single and SingleOrDefault in C#, addressing the misconception that they always traverse an entire Enumerable. It explains the actual behavior of these methods, both with and without a predicate, contrasting them with First and FirstOrDefault. The article clarifies that SingleOrDefault efficiently handles different scenarios, such as returning a default value, the only item, or throwing an error when multiple items exist. It emphasizes the operational differences and efficiency O(1) without predicate and O(N) with predicate of these methods, offering valuable insights for C# developers seeking to optimize their code.

Implementing CQRS with MediatR - Part 5

Part 5 of the CQRS with MediatR series introduces Event Sourcing using EventStore. It focuses on integrating EventStore into an ASP.NET Core application, highlighted by creating the EventStoreDbContext class. The tutorial showcases the EventLoggerBehavior in MediatR for logging Command actions and responses, utilizing a Convention over Configuration approach. This part provides a practical guide for effectively tracking and understanding system state changes in a CQRS application through event history.

Implementing CQRS with MediatR - Part 4

In this part of the CQRS with MediatR series, behaviors in MediatR are introduced for aspect-oriented programming. The tutorial covers two specific behaviors:
  • Performance counter behavior: for logging method execution times.
  • Transaction behavior: for managing database transactions and rollbacks.

  • Both are implemented using the IPipelineBehavior interface, demonstrating how to write reusable, efficient code that adheres to the DRY principle. The article provides practical examples and code snippets, showing how these behaviors enhance functionality and error handling in an ASP.NET Core application.

    Implementing CQRS with MediatR - Part 3

    Part 3 of the CQRS with MediatR series focuses on adding validation and event handling. Fluent Validation is introduced to validate commands, followed by the use of INotification and INotificationHandler for event handling, illustrated with a CustomerCreatedEvent. This setup allows for separate event handlers for different actions like email notifications and logging, adhering to the Single Responsibility Principle. The tutorial provides code examples for integrating these features into an ASP.NET Core application, setting the stage for the next part on MediatR behaviors and aspect-oriented programming.

    Implementing CQRS with MediatR - Part 2

    Discover the practical implementation of the CQRS pattern using MediatR in ASP.NET Core. This tutorial guides you through setting up MediatR, creating commands and queries with the IRequest interface, and handling them with IRequestHandler. It features a real-world example of adding a customer to a database, showcasing command creation, immutability, and the use of Entity Framework and AutoMapper. The article emphasizes decoupling in request handling, aligning with the Hollywood Principle, and provides a glimpse into future topics like Fluent Validation. A must-read for developers looking to enhance their CQRS skills.

    Implementing CQRS with MediatR - Part 1

    This article dives into the implementation of the CQRS design pattern using the MediatR library in .NET, simplifying its complexity. It explains the division of application methods into Command and Query functions, highlighting the benefits of this separation for technology choice and scalability. The piece also touches on the concept of events and Event Sourcing, showcasing their roles in maintaining system states and facilitating troubleshooting. The use of the Event Store database for implementing Event Sourcing is briefly introduced, offering a comprehensive view of the CQRS pattern and its practical application.

    Design Patterns - Mediator

    Explore the Mediator design pattern, illustrated through an airport control tower analogy. Learn how it manages communications between planes in C#, starting from the IAirTrafficControl interface to the implementation of AirbusAirplane and BoeingAirplane classes. The article concludes with the JFKAirTrafficControl class, demonstrating the pattern’s role in facilitating effective object interaction. Ideal for those interested in applying design patterns in software engineering.