Kay.SharedKernel.Infrastructure 1.0.0

dotnet add package Kay.SharedKernel.Infrastructure --version 1.0.0
                    
NuGet\Install-Package Kay.SharedKernel.Infrastructure -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kay.SharedKernel.Infrastructure" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kay.SharedKernel.Infrastructure" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Kay.SharedKernel.Infrastructure" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kay.SharedKernel.Infrastructure --version 1.0.0
                    
#r "nuget: Kay.SharedKernel.Infrastructure, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Kay.SharedKernel.Infrastructure@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kay.SharedKernel.Infrastructure&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Kay.SharedKernel.Infrastructure&version=1.0.0
                    
Install as a Cake Tool

Kay

Overview

Welcome to the .NET 8 C# microservices project, leveraging various industry best practices and design patterns to ensure a robust, scalable, and maintainable solution. This project embraces technologies like Entity Framework Core 8, C# 12, Clean Architecture, Domain-Driven Design (DDD), Event-Driven Design, and follows industry standards such as CQRS, Specification Pattern, SOLID principles, Gang of Four Design Patterns, Outbox Pattern, and more.

Project Structure

Follows Clean Architecture and Domain-Driven Design principles, separating bounded contexts into individual microservices. This ensures a clear separation of concerns, scalability, and maintainability.

Key Technologies

  • .NET 8
  • C# 12
  • Entity Framework Core 8
  • MediatR and FluentValidation for validation
  • Polly for fault handling
  • Moq, Fluent Assertion, and xUnit for unit testing
  • Dapper for faster SQL queries
  • Marten Document Database with PostgreSQL for NoSQL requirements
  • RabbitMQ and MassTransit for message queue
  • Redis for distributed caching
  • Docker, Docker Compose, and Kubernetes for containerization and orchestration

Design Patterns and Practices

  • CQRS (Command Query Responsibility Segregation)
  • Specification Pattern
  • SOLID Principles
  • Gang of Four Design Patterns
  • Outbox Pattern
  • Domain Event Pattern
  • DDD CAP Theorem
  • Unit of Work pattern with EF Core
  • Smart Enums with rich behavior
  • Materialized View for speeding up queries
  • Event-Driven Architecture
  • API Idempotency to prevent duplicate requests

Testing

Unit testing is done using Moq, Fluent Assertion, and xUnit. This ensures the reliability and correctness of the codebase.

Data Access

EF Core is used for relational databases, while Dapper is employed for faster SQL queries. Marten Document Database with PostgreSQL is chosen for microservices requiring a NoSQL solution.

Observability

Logging is treated as a cross-cutting concern and is addressed using MediatR. Message queues (RabbitMQ and MassTransit) enhance observability by facilitating asynchronous communication.

Idempotency and Saga

Idempotency is ensured through API design, preventing the execution of duplicate requests. The system employs Domain Events to build a decoupled architecture that scales. Sagas are implemented to manage long-running processes.

Deployment

The project is containerized using Docker, orchestrated with Docker Compose, and can be scaled using Kubernetes for efficient deployment and management.

Additional Best Practices

  • Follow principles of OOP
  • Use Value Objects to overcome Primitive Obsession
  • Aggregate Root design for maintaining consistency
  • Handle duplicate messages and API calls with idempotent strategies
  • Implement distributed caching with Redis for performance optimization

API Gateway

Introducing the API Gateway using YARP (Yet Another Reverse Proxy). YARP provides a flexible and efficient way to route, load balance, and secure traffic to the microservices. It acts as the entry point to the system, managing requests and distributing them to the appropriate microservices. This enhances the system's scalability, resilience, and security.

Feel free to explore the codebase and contribute to this well-architected, industry-standard microservices project. Happy coding!

References

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Kay.SharedKernel.Infrastructure:

Package Downloads
Kay.SharedKernel.Presentation

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 159 1/21/2026