Skip to content

Libraries Catalog

This document catalogs the ConnectSoft.Extensions.* libraries and other reusable libraries available for use in Factory-generated systems and by human developers. It is written for developers and architects selecting libraries for their projects.

ConnectSoft maintains a comprehensive set of reusable libraries that provide common functionality across all generated systems. These libraries follow ConnectSoft's architectural principles, are designed for multi-tenant SaaS applications, and integrate seamlessly with Factory-generated code.

Tip

Use ConnectSoft.Extensions.* libraries for common functionality. They're battle-tested, multi-tenant-safe, and integrate seamlessly with Factory-generated code. All libraries follow semantic versioning and are compatible with Factory-generated services.

Available Libraries

ConnectSoft provides a curated set of reusable libraries published as NuGet packages. Each library is designed to encapsulate a specific cross-cutting concern or foundational capability for modern .NET applications.

All packages are compatible with .NET 8 and .NET 9 (multi-targeted) and align with best practices in microservice, DDD, and configuration-driven environments.

1. ConnectSoft.Extensions

  • Purpose: Utility extensions for native .NET types (string, int, DateTime, etc.) and shared base types.
  • Key Features:
    • string.ToSlug(), int.IsEven(), DateTime.IsWeekend()
    • IEnumerable<T>.IsNullOrEmpty()
    • Base exception for domain logic: DomainModelException
  • Use Cases: Utility libraries, shared code, microservices
  • NuGet: View Package
  • Status: 🟢 Stable

2. ConnectSoft.Extensions.DataAnnotations

  • Purpose: Adds missing validation functionality to .NET's DataAnnotations system.
  • Key Features:
    • NotDefaultAttribute — works on any struct (Guid, DateTime, int, etc.)
    • Null-safe: integrates cleanly with [Required] if needed
    • Supports IOptions<T>, domain models, and DTOs
  • Use Cases: Domain validation, configuration binding, API model validation
  • NuGet: View Package
  • Status: 🟢 Stable

3. ConnectSoft.Extensions.Options

  • Purpose: Provides a standardized extension method for registering and validating options with dependency injection. Encapsulates the common pattern used across all ConnectSoft libraries and templates for options registration.
  • Key Features:
    • Configuration binding with strict validation (ErrorOnUnknownConfiguration = true)
    • DataAnnotations validation (automatic validation of [Required], [Range], etc.)
    • Custom validator support via IValidateOptions<TOptions>
    • Fail-fast validation on startup
    • Singleton validator registration with auto-activation
  • Use Cases: Options registration in ConnectSoft libraries, configuration validation in templates, standardized options pattern across projects, eliminating code duplication
  • Framework: .NET 8 and .NET 9
  • NuGet: View Package
  • Source: Repository
  • Status: 🟢 Stable

4. ConnectSoft.Extensions.Localization

  • Purpose: Provides reusable localization functionality for .NET applications. Enables configuration and use of .NET's built-in localization infrastructure with strongly-typed options, validation, and a clean API.
  • Key Features:
    • Strongly-typed IOptions<T>-based configuration
    • Options validation with DataAnnotations
    • Automatic ResourceManagerStringLocalizerFactory registration
    • Configurable supported cultures and UI cultures
    • Parent culture fallback support
    • Response header culture application
    • Uses ConnectSoft.Extensions.Options for standardized options registration
  • Use Cases: Multi-language web applications, internationalization (i18n) support, localized resource management, culture-aware applications, multi-tenant SaaS applications with localization
  • Framework: .NET 8 and .NET 9
  • NuGet: View Package
  • Source: Repository
  • Status: 🟢 Stable

5. ConnectSoft.Extensions.DatabaseModel

  • Purpose: Provides an abstraction layer for managing and provisioning database instances.
  • Key Features:
    • IDatabaseHelper interface for cross-database operations: creation, schema setup, SQL execution
    • Core interface, no database-specific logic
  • Use Cases: Infrastructure initialization, CI/CD provisioning, tenant setup
  • NuGet: View Package
  • Status: 🟢 Stable

Implementors

  • ConnectSoft.Extensions.DatabaseModel.SqlServer - SQL Server implementation of IDatabaseHelper using SqlConnection.
  • ConnectSoft.Extensions.DatabaseModel.PostgreSql - PostgreSQL implementation with NpgsqlConnection.
  • ConnectSoft.Extensions.DatabaseModel.MySql - MySQL implementation using MySqlConnector.

6. ConnectSoft.Extensions.Globalization

  • Purpose: Provides utilities and calendar extensions for working with the Jewish calendar and Hebrew characters.
  • Key Features:
    • Gregorian ⇄ Jewish date conversions
    • Jewish holiday recognition
    • Leap year and day-of-week calculations
    • Hebrew character classification (letters, finals, etc.)
  • Use Cases: Localization engines, religious calendar support, Hebrew text analysis
  • NuGet: View Package
  • Status: 🟢 Stable

7. ConnectSoft.Extensions.MessagingModel

A messaging-agnostic abstraction that defines base interfaces for event-driven communication patterns.

  • Purpose: Acts as the foundation for messaging libraries, providing core contracts like ICommand, IEvent, and IEventBus.
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.MessagingModel
  • Source: Repository
  • Status: 🟢 Stable
  • Implementations:
    • ConnectSoft.Extensions.MessagingModel.NServiceBus
    • ConnectSoft.Extensions.MessagingModel.MassTransit

8. ConnectSoft.Extensions.MessagingModel.MassTransit

MassTransit-based implementation of the ConnectSoft messaging model abstraction.

9. ConnectSoft.ExtensionsMessagingModel.NServiceBus

NServiceBus-based implementation of the ConnectSoft messaging model abstraction.

10. ConnectSoft.Extensions.EntityModel

Comprehensive modeling base for Domain-Driven Design (DDD) in .NET applications.

  • Purpose: Provides base contracts for entities, value objects, aggregate roots, and rich enumerations. Enables consistent modeling patterns across bounded contexts.
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.EntityModel
  • Source: Repository

11. ConnectSoft.Extensions.DomainModel

Foundation for implementing Domain Services and Use Case handlers based on Domain-Driven Design (DDD), Clean Architecture, and Hexagonal Architecture principles.

  • Purpose: Supports separation of concerns by defining contracts for IDomainService and IUseCase<TInput, TOutput>; enables maintainable, testable application cores.
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.DomainModel
  • Source: Repository

12. ConnectSoft.Extensions.DomainModel.Impl

🛠️ Under Construction

Implementation-ready shell for domain modeling components (IDomainService, IUseCase, etc.) defined in ConnectSoft.Extensions.DomainModel.

13. ConnectSoft.Extensions.Transactions

Lightweight abstraction for managing transactional boundaries in a clean and testable manner.

14. ConnectSoft.Extensions.PersistenceModel

Data source–agnostic abstraction for persistence patterns such as repository, unit of work, specifications, and queries. Designed for use with DDD and clean architecture approaches.

15. ConnectSoft.Extensions.PersistenceModel.DependencyInjection

Dependency injection extensions for the ConnectSoft persistence model.

  • Purpose: Provides Microsoft.Extensions.DependencyInjection–based implementations of key infrastructure components:
    • IQueryBuilderMicrosoftQueryBuilder
    • ISpecificationLocatorMicrosoftSpecificationLocator
    • Designed to seamlessly resolve queries and specifications for repositories via standard .NET DI.
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.PersistenceModel.DependencyInjection
  • Source: Repository

16. ConnectSoft.Extensions.PersistenceModel.NHibernate

NHibernate-based implementation of the ConnectSoft persistence model abstraction.

17. ConnectSoft.Extensions.PersistenceModel.MongoDb

Enterprise-grade MongoDB persistence implementation with comprehensive data access patterns.

  • Purpose: Provides repository, unit of work, specification patterns, transaction support, migration framework, and built-in observability for MongoDB-based applications. Enables consistent data access patterns across document databases.
  • Key Features:
    • Generic and read-only repositories with type safety
    • Multi-document ACID transaction support
    • Session-based transaction management
    • Specification pattern for composable queries
    • Migration framework for schema evolution
    • OpenTelemetry tracing for observability
    • Keyed dependency injection for multi-database scenarios
  • Use Cases: Document-based applications, content management systems, event sourcing, NoSQL data stores, high-throughput systems
  • Business Value: Enables MongoDB adoption with enterprise patterns, reduces data access complexity, supports schema evolution, improves operational visibility
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.PersistenceModel.MongoDb
  • Source: Repository
  • Status: 🟢 Stable

18. ConnectSoft.Extensions.ServiceModel

Communication-agnostic base library for structured service contracts, fault handling, and interoperable message definitions.

  • Purpose: Defines fault contracts, service/message wrappers, and metadata for use across WCF, REST, gRPC, CoreWCF, Orleans, and Service Fabric.
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.ServiceModel
  • Source: Repository

19. ConnectSoft.Text.Json

Extension library built on System.Text.Json to enhance enum serialization, formatting, and deserialization behaviors.

  • Purpose: Supports [EnumMember(Value = "...")], improves compatibility with external APIs, and simplifies JSON configuration.
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Text.Json
  • Source: Repository

20. ConnectSoft.Extensions.Http.OAuth2

Extensible, DI-based library for OAuth 2.0 token acquisition and management in .NET 8 and .NET 9.

  • Purpose: Supports multiple grant types (client credentials, password, refresh), named clients, token caching, ID token validation, and test automation with WireMock.
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.Http.OAuth2
  • Source: Repository

21. ConnectSoft.Net.Http

Extension utilities for working with HttpClient in .NET.

  • Purpose: Adds missing methods like DeleteAsJsonAsync, and includes SubdirectoryHandler for reverse proxy URL rewriting — useful in gRPC or IIS-hosted services.
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Net.Http
  • Source: Repository

22. ConnectSoft.Extensions.Compliance

Reusable compliance and data redaction library that standardizes PII protection and sensitive data handling across ConnectSoft services.

  • Purpose: Provides data classification and redaction capabilities to protect personally identifiable information (PII) and sensitive data in logs, APIs, and application output. Enables GDPR, SOC2, and HIPAA compliance readiness.
  • Key Features:
    • Automatic redaction of email addresses, phone numbers, payment card data, JWT tokens, IP addresses, and secrets
    • Configurable redaction profiles (default, audit, strict) for different compliance requirements
    • Structured logging integration that automatically masks sensitive data
    • Development-mode strict redaction to prevent accidental data exposure
  • Use Cases: Compliance-critical applications, multi-tenant SaaS platforms, financial services, healthcare systems, audit-ready logging
  • Business Value: Reduces compliance risk, enables audit trails, protects customer data, supports regulatory requirements
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.Compliance
  • Source: Repository
  • Status: 🟢 Stable

23. ConnectSoft.Extensions.Diagnostics.HealthChecks

Shared building blocks for implementing application health monitoring and reliability checks.

  • Purpose: Provides reusable infrastructure for health checks that enable proactive monitoring, issue detection, and system reliability assurance. Essential for production-ready applications and high-availability systems.
  • Key Features:
    • Lightweight health check infrastructure with minimal dependencies
    • DelegateHealthCheck for quick health check implementation
    • Validated options and configuration support
  • Use Cases: Production monitoring, load balancer health endpoints, container orchestration, service mesh integration, SLA compliance
  • Business Value: Improves system reliability, enables proactive issue detection, supports SLA commitments, reduces downtime
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.Diagnostics.HealthChecks
  • Source: Repository
  • Status: 🟢 Stable

Implementors

  • ConnectSoft.Extensions.Diagnostics.HealthChecks.SignalR - SignalR-specific health checks for monitoring real-time communication hub connectivity. Ensures WebSocket and SignalR connections are operational for real-time features.
  • ConnectSoft.Extensions.Diagnostics.HealthChecks.Orleans - Orleans-specific health checks for monitoring distributed actor systems, including cluster health, silo status, grain activation, and storage connectivity.

24. ConnectSoft.Extensions.Diagnostics.HealthChecks.SignalR

Health checks specifically designed for monitoring SignalR hub connectivity and real-time communication infrastructure.

  • Purpose: Monitors SignalR hub endpoints to ensure real-time communication features are operational. Automatically discovers hub URLs and verifies connectivity.
  • Key Features:
    • Automatic hub URL discovery from server addresses, environment variables, or configuration
    • Configurable hub paths and connection options
    • TestServer-friendly configuration for integration testing
  • Use Cases: Real-time applications, chat systems, live dashboards, collaborative tools, WebSocket-dependent services
  • Business Value: Ensures real-time features remain available, prevents silent failures in WebSocket connections, supports user experience SLAs
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.Diagnostics.HealthChecks.SignalR
  • Source: Repository
  • Status: 🟢 Stable

25. ConnectSoft.Extensions.Diagnostics.HealthChecks.Orleans

Production-ready health checks for monitoring Orleans distributed actor systems and cluster health.

  • Purpose: Provides comprehensive health monitoring for Orleans-based applications, including cluster status, silo health, grain activation, and storage connectivity. Essential for distributed systems reliability.
  • Key Features:
    • Cluster health monitoring to detect unavailable silos
    • Silo health verification using health check participants
    • Grain activation and communication testing
    • Storage health checks for grain state persistence
    • Azure Table Storage and Blob Storage health monitoring
    • Managed identity support for Azure authentication
  • Use Cases: Distributed actor systems, high-throughput processing, stateful microservices, Orleans-based applications
  • Business Value: Ensures distributed system reliability, enables proactive cluster management, supports high-availability architectures, prevents cascading failures
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.Diagnostics.HealthChecks.Orleans
  • Source: Repository
  • Status: 🟢 Stable

26. ConnectSoft.Extensions.AspNetCore

ASP.NET Core extensions for web application development and performance monitoring.

  • Purpose: Provides Server-Timing middleware for exposing backend performance metrics to browser developer tools, AJAX request detection, local request identification, and other ASP.NET Core utilities.
  • Key Features:
    • Server-Timing HTTP header support for performance metrics
    • AJAX request detection via X-Requested-With header
    • Local request identification for security and routing
    • Middleware integration for ASP.NET Core pipelines
  • Use Cases: Web applications, API services, performance monitoring, security filtering, development tooling
  • Business Value: Improves developer experience with performance insights, enables better debugging, supports security filtering, enhances observability
  • Framework: .NET 6, .NET 8, and .NET 9
  • NuGet: ConnectSoft.Extensions.AspNetCore
  • Source: Repository
  • Status: 🟢 Stable

27. ConnectSoft.Extensions.ServiceModel.Grpc

gRPC service communication with code-first approach and enterprise features.

  • Purpose: Provides gRPC service hosting with code-first approach (no .proto files required), exception handling, interceptors, fault contract transformation, JSON marshalling, and Brotli compression. Enables migration from WCF to gRPC with minimal effort.
  • Key Features:
    • Code-first service definition (no .proto files)
    • Exception handling and fault contract transformation
    • Server interceptors and filters
    • JSON marshalling support
    • Brotli compression for improved bandwidth efficiency
    • Structured logging integration
  • Use Cases: High-performance microservices, inter-service communication, API gateways, real-time systems, WCF migration
  • Business Value: Reduces development complexity, improves performance, enables modern service communication, supports legacy system migration
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.ServiceModel.Grpc
  • Source: Repository
  • Status: 🟢 Stable

28. ConnectSoft.Extensions.ServiceModel.Grpc.Client

gRPC client implementation for consuming gRPC services with code-first approach.

  • Purpose: Provides gRPC client functionality for consuming services built with ConnectSoft.Extensions.ServiceModel.Grpc, supporting code-first approach without requiring .proto files.
  • Key Features:
    • Code-first client generation
    • Type-safe service contracts
    • Exception handling and fault contract support
    • Integration with HttpClientFactory
  • Use Cases: Service consumers, API clients, microservice communication, distributed systems
  • Business Value: Simplifies client development, ensures type safety, reduces integration complexity, supports modern service communication
  • Framework: .NET 8 and .NET 9
  • NuGet: ConnectSoft.Extensions.ServiceModel.Grpc.Client
  • Source: Repository
  • Status: 🟢 Stable

Library Families (Summary)

For quick reference, here are the main library families:

Library / Namespace Purpose Typical Consumers
ConnectSoft.Extensions Utility extensions for native .NET types All projects
ConnectSoft.Extensions.DataAnnotations Enhanced validation attributes Domain models, DTOs
ConnectSoft.Extensions.DatabaseModel Database provisioning abstraction Infrastructure, CI/CD
ConnectSoft.Extensions.Globalization Jewish calendar and Hebrew text utilities Localization engines
ConnectSoft.Extensions.MessagingModel Messaging abstractions (MassTransit, NServiceBus) Event-driven services
ConnectSoft.Extensions.EntityModel DDD entity and value object base classes Domain models
ConnectSoft.Extensions.DomainModel Domain services and use case contracts Application layer
ConnectSoft.Extensions.Transactions Transaction management abstraction Persistence layer
ConnectSoft.Extensions.PersistenceModel Repository and specification patterns Data access layer
ConnectSoft.Extensions.ServiceModel Service contract definitions API layer
ConnectSoft.Text.Json Enhanced JSON serialization All projects
ConnectSoft.Extensions.Http.OAuth2 OAuth2 token management API clients
ConnectSoft.Net.Http HttpClient extensions API clients
ConnectSoft.Extensions.Compliance PII protection and data redaction Compliance-critical applications
ConnectSoft.Extensions.Diagnostics.HealthChecks Health monitoring infrastructure Production services
ConnectSoft.Extensions.Diagnostics.HealthChecks.SignalR Real-time communication monitoring SignalR applications
ConnectSoft.Extensions.Diagnostics.HealthChecks.Orleans Distributed system health monitoring Orleans applications
ConnectSoft.Extensions.AspNetCore ASP.NET Core utilities and performance monitoring Web applications
ConnectSoft.Extensions.PersistenceModel.MongoDb MongoDB persistence patterns Document-based applications
ConnectSoft.Extensions.ServiceModel.Grpc gRPC service hosting High-performance microservices
ConnectSoft.Extensions.ServiceModel.Grpc.Client gRPC client implementation Service consumers

Stay tuned for more reusable and production-ready components.

Common Usage Patterns

Dependency Injection Registration

Pattern: Register libraries in Program.cs or Startup.cs:

using ConnectSoft.Extensions.Logging;
using ConnectSoft.Extensions.OpenTelemetry;
using ConnectSoft.Extensions.Messaging;
using ConnectSoft.Extensions.Identity;

var builder = WebApplication.CreateBuilder(args);

// Register logging with correlation ID support
builder.Services.AddConnectSoftLogging(options =>
{
    options.EnableCorrelationId = true;
    options.LogLevel = LogLevel.Information;
});

// Register OpenTelemetry tracing and metrics
builder.Services.AddConnectSoftOpenTelemetry(options =>
{
    options.ServiceName = "InvoiceService";
    options.EnableTracing = true;
    options.EnableMetrics = true;
});

// Register messaging (Service Bus)
builder.Services.AddConnectSoftMessaging(options =>
{
    options.ConnectionString = builder.Configuration["ServiceBus:ConnectionString"];
    options.EnableEventPublishing = true;
});

// Register identity and tenant context
builder.Services.AddConnectSoftIdentity(options =>
{
    options.TenantContextHeader = "X-Tenant-Id";
    options.EnableTenantIsolation = true;
});

var app = builder.Build();

Using Libraries in Generated Services

Pattern: Use libraries in use cases, repositories, and controllers:

using ConnectSoft.Extensions.Logging;
using ConnectSoft.Extensions.Messaging;
using ConnectSoft.Extensions.Identity;

public class CreateInvoiceUseCase
{
    private readonly ILogger<CreateInvoiceUseCase> _logger;
    private readonly IEventPublisher _eventPublisher;
    private readonly ITenantContext _tenantContext;

    public CreateInvoiceUseCase(
        ILogger<CreateInvoiceUseCase> logger,
        IEventPublisher eventPublisher,
        ITenantContext tenantContext)
    {
        _logger = logger;
        _eventPublisher = eventPublisher;
        _tenantContext = tenantContext;
    }

    public async Task<InvoiceDto> ExecuteAsync(CreateInvoiceRequest request)
    {
        // Log with correlation ID (automatically included)
        _logger.LogInformation("Creating invoice for tenant {TenantId}", 
            _tenantContext.CurrentTenantId);

        // Create invoice (domain logic)
        var invoice = new Invoice(...);

        // Publish domain event
        await _eventPublisher.PublishAsync(new InvoiceCreatedEvent
        {
            InvoiceId = invoice.Id,
            TenantId = _tenantContext.CurrentTenantId
        });

        return InvoiceMapper.ToDto(invoice);
    }
}

HTTP Client with Retry and Circuit Breaker

Pattern: Use HTTP extension for resilient external API calls:

using ConnectSoft.Extensions.Http;

// Register HTTP client with retry and circuit breaker
builder.Services.AddConnectSoftHttpClient<IPaymentGatewayClient, PaymentGatewayClient>(options =>
{
    options.BaseAddress = new Uri("https://api.paymentgateway.com");
    options.RetryPolicy = RetryPolicy.ExponentialBackoff(maxRetries: 3);
    options.CircuitBreaker = new CircuitBreakerOptions
    {
        FailureThreshold = 5,
        DurationOfBreak = TimeSpan.FromSeconds(30)
    };
});

// Use in service
public class PaymentService
{
    private readonly IPaymentGatewayClient _paymentClient;

    public async Task<PaymentResult> ProcessPaymentAsync(PaymentRequest request)
    {
        // Automatic retry and circuit breaker handling
        var response = await _paymentClient.ProcessPaymentAsync(request);
        return response;
    }
}

Audit Logging

Pattern: Use audit extension for compliance logging:

using ConnectSoft.Extensions.Audit;

public class InvoiceService
{
    private readonly IAuditLogger _auditLogger;

    public async Task CreateInvoiceAsync(CreateInvoiceRequest request)
    {
        // Create invoice
        var invoice = new Invoice(...);

        // Log audit event
        await _auditLogger.LogAsync(new AuditEvent
        {
            Action = "InvoiceCreated",
            EntityType = "Invoice",
            EntityId = invoice.Id.ToString(),
            TenantId = _tenantContext.CurrentTenantId,
            UserId = _userContext.CurrentUserId,
            Timestamp = DateTime.UtcNow,
            Details = new { Amount = invoice.Amount, Status = invoice.Status }
        });
    }
}

Versioning and Compatibility

Semantic Versioning

All ConnectSoft.Extensions.* libraries follow semantic versioning (SemVer):

  • Major version - Breaking changes (e.g., 2.0.0)
  • Minor version - New features, backward compatible (e.g., 1.1.0)
  • Patch version - Bug fixes, backward compatible (e.g., 1.0.1)

Factory Version Pinning

The Factory pins library versions in generated projects:

  • Generated services reference specific library versions (e.g., ConnectSoft.Extensions.Logging version 1.2.3)
  • Version compatibility - Factory ensures compatible versions across all libraries
  • Update policy - Factory updates library versions in new generations, existing services can update manually

Compatibility Policy

Important

Generated services should not downgrade library versions below those supported by the Factory. Upgrading to newer minor/patch versions is safe and recommended. Major version upgrades require careful testing and may require code changes.

Compatibility Rules:

  • Same major version - Minor and patch updates are safe
  • Different major version - Requires code review and testing
  • Factory support - Factory supports latest 2 major versions of each library

Version Update Example

Scenario: Update ConnectSoft.Extensions.Logging from 1.2.3 to 1.3.0.

Process:

  1. Update package reference in .csproj:
    <PackageReference Include="ConnectSoft.Extensions.Logging" Version="1.3.0" />
    
  2. Run dotnet restore and dotnet build
  3. Test service to ensure compatibility
  4. Deploy updated service

Breaking Change: If updating to 2.0.0, review breaking changes in library changelog and update code accordingly.

Example Integration

Here's a complete example showing a microservice using multiple libraries:

// Program.cs - Service registration
using ConnectSoft.Extensions.Logging;
using ConnectSoft.Extensions.OpenTelemetry;
using ConnectSoft.Extensions.Messaging;
using ConnectSoft.Extensions.Identity;
using ConnectSoft.Extensions.Audit;

var builder = WebApplication.CreateBuilder(args);

// Register all extensions
builder.Services.AddConnectSoftLogging();
builder.Services.AddConnectSoftOpenTelemetry(options =>
{
    options.ServiceName = "InvoiceService";
});
builder.Services.AddConnectSoftMessaging(options =>
{
    options.ConnectionString = builder.Configuration["ServiceBus:ConnectionString"];
});
builder.Services.AddConnectSoftIdentity();
builder.Services.AddConnectSoftAudit();

// Register application services
builder.Services.AddScoped<ICreateInvoiceUseCase, CreateInvoiceUseCase>();

var app = builder.Build();

// Use in controller
app.MapPost("/invoices", async (CreateInvoiceRequest request, 
    ICreateInvoiceUseCase useCase) =>
{
    return await useCase.ExecuteAsync(request);
});

app.Run();

// UseCase - Using libraries
public class CreateInvoiceUseCase : ICreateInvoiceUseCase
{
    private readonly ILogger<CreateInvoiceUseCase> _logger;
    private readonly IEventPublisher _eventPublisher;
    private readonly ITenantContext _tenantContext;
    private readonly IAuditLogger _auditLogger;

    public CreateInvoiceUseCase(
        ILogger<CreateInvoiceUseCase> logger,
        IEventPublisher eventPublisher,
        ITenantContext tenantContext,
        IAuditLogger auditLogger)
    {
        _logger = logger;
        _eventPublisher = eventPublisher;
        _tenantContext = tenantContext;
        _auditLogger = auditLogger;
    }

    public async Task<InvoiceDto> ExecuteAsync(CreateInvoiceRequest request)
    {
        // Logging with correlation ID
        _logger.LogInformation("Creating invoice for tenant {TenantId}", 
            _tenantContext.CurrentTenantId);

        // Create invoice (domain logic)
        var invoice = new Invoice(request.Amount, request.Description);

        // Publish domain event
        await _eventPublisher.PublishAsync(new InvoiceCreatedEvent
        {
            InvoiceId = invoice.Id,
            TenantId = _tenantContext.CurrentTenantId
        });

        // Audit log
        await _auditLogger.LogAsync(new AuditEvent
        {
            Action = "InvoiceCreated",
            EntityId = invoice.Id.ToString(),
            TenantId = _tenantContext.CurrentTenantId
        });

        return InvoiceMapper.ToDto(invoice);
    }
}

Key Points:

  • All libraries registered in Program.cs
  • Libraries used throughout the service (logging, messaging, identity, audit)
  • Correlation IDs, tenant context, and audit logging work automatically
  • OpenTelemetry tracing includes all operations