Skip to content

v0.9.0

Choose a tag to compare

@joeloudjinz joeloudjinz released this 23 Nov 18:22
· 16 commits to main since this release
84e89d6

InzDynamicModuleLoader v0.9.0 - Release Notes

Overview

Welcome to version 0.9.0 of InzDynamicModuleLoader, a robust .NET 9.0 library that enables plugin-based architecture by loading modules at startup time. This release introduces dynamic module loading system that allows for better separation of concerns, module isolation, and flexible infrastructure switching while maintaining clean architecture boundaries.

Key Features

Dynamic Module Loading System

  • Plugin Architecture: Load modules at runtime based on configuration
  • Easy Integration: Simple setup with .NET's built-in dependency injection
  • Configuration-Driven: Control which modules load through configuration files
  • Development & Production: Works seamlessly in both environments

Advanced Dependency Resolution

  • Optimized Assembly Resolution: Implements an optimized 4-step search strategy with caching
  • Locality-Based Resolution: Checks requesting assembly's folder first for faster dependency loading
  • Resource Filtering: Early filtering of .resources.dll files to improve performance
  • Caching Mechanism: Concurrent cache for assembly name to file path mappings

Module Lifecycle Management

  • Service Registration: Register module services with dependency injection container
  • Service Initialization: Initialize services after registration phase
  • Assembly Loading Context: Properly handles assembly loading in default context
  • Module Registry: Tracks loaded assemblies and module definitions

Technical Improvements

Performance Optimizations

  • Efficient Search Strategy: Implements optimized dependency resolution with O(1) cache lookups

Development & Production Support

  • Dual Environment Support: Automatically detects development (BuiltModules) vs production (Modules) scenarios
  • Directory Traversal: Searches parent directories to locate modules in development
  • Path Resolution: Handles both local modules folder and solution output directory

Error Handling & Diagnostics

  • Exception Handling: Proper exception handling during assembly loading
  • Validation: Ensures only one IAmModule implementation per assembly

Included Components

Core Architecture

  • IAmModule interface: Contract for modules with RegisterServices and InitializeServices methods
  • ModuleLoader: Handles dynamic assembly loading and dependency resolution
  • ModuleRegistry: Tracks loaded assemblies and module definitions
  • Extension methods: RegisterModules and InitializeModules for easy integration

Build System Integration

  • Directory.Build.targets: MSBuild customization for automatic module deployment
  • Directory.Packages.props: Central Package Management for version consistency

Example Implementation

This release includes an example demonstrating real-world usage:

  • Multi-database Support: Switch between MySQL and PostgreSQL at startup
  • Shared Contracts: Common interfaces and data models
  • EF Core Repositories: Generic repository implementation
  • Runtime Flexibility: Infrastructure switching without code changes
  • Clean Architecture: Proper separation of concerns

Documentation

Complete documentation included covering:

  • Directory.Build.targets configuration
  • Directory.Packages.props usage
  • Example implementation breakdown

Testing & Validation

The library has been validated through a comprehensive example that demonstrates:

  • Dynamic loading of database provider modules
  • Runtime switching between MySQL and PostgreSQL
  • Integration with Entity Framework Core
  • Proper service registration and initialization

Architecture Benefits

  • Modularity: Clean separation of concerns between different functionality
  • Flexibility: Switch infrastructure components at runtime
  • Scalability: Easy to add new modules without touching core code
  • Maintainability: Each module can be developed and maintained independently
  • Version Consistency: Centralized package management prevents diamond dependency issues

Prerequisites

  • .NET 9.0 or higher

Authors

Developed by Abdellah Addoun (InzSoftwares)

Package Information

  • Package ID: InzSoftwares.NetDynamicModuleLoader
  • Version: 0.9.0
  • License: MIT
  • Target Framework: .NET 9.0

InzDynamicModuleLoader v0.9.0 is now available on NuGet. This release represents the first milestone in enabling flexible, modular applications with .NET.