Skip to content

Feature Modules Refactoring and API Improvements#16

Merged
penyland merged 3 commits intomainfrom
azure-app-conf-fixes
Nov 2, 2025
Merged

Feature Modules Refactoring and API Improvements#16
penyland merged 3 commits intomainfrom
azure-app-conf-fixes

Conversation

@penyland
Copy link
Owner

@penyland penyland commented Nov 2, 2025

This pull request introduces significant refactoring and improvements to the feature modules infrastructure, focusing on simplifying module registration, improving type safety, and modernizing extension points. The changes also include minor updates to diagnostics configuration and versioning.

Feature Modules Refactoring and API Improvements:

  • Refactored the feature module interfaces and base classes to remove nullable ModuleInfo, enforce non-nullable IModuleInfo, and change the module registration pattern from returning a ModuleContext to a void method that takes an IHostApplicationBuilder. This simplifies module implementation and aligns with modern DI patterns. (src/Infinity.Toolkit.FeatureModules/IFeatureModule.cs, src/Infinity.Toolkit.FeatureModules/FeatureModule.cs, src/Infinity.Toolkit.FeatureModules/IModuleInfo.cs, samples/FeatureModulesSample/FeatureModule.cs, [1] [2] [3] [4] [5] [6] [7]
  • Removed the obsolete ModuleContext record and the ModuleUtilities helper, consolidating module discovery and registration logic into the new IHostApplicationBuilderExtensions class. (src/Infinity.Toolkit.FeatureModules/ModuleContext.cs, src/Infinity.Toolkit.FeatureModules/ModuleUtilities.cs, [1] [2]
  • Renamed and refactored the main extension class from WebApplicationBuilderExtensions to IHostApplicationBuilderExtensions, updating all related methods to use IHostApplicationBuilder instead of WebApplicationBuilder. This provides greater flexibility and compatibility with generic hosting scenarios. (src/Infinity.Toolkit.FeatureModules/IHostApplicationBuilderExtensions.cs, [1] [2] [3] [4] [5] [6]
  • Improved module discovery logic by embedding it directly in the extension class and making the process more robust and informative via logging. (src/Infinity.Toolkit.FeatureModules/IHostApplicationBuilderExtensions.cs, src/Infinity.Toolkit.FeatureModules/IHostApplicationBuilderExtensions.csL63-R118)

Azure App Configuration Improvements:

  • Enhanced the Azure App Configuration extension to log a warning (instead of failing silently or logging errors) when no valid connection string or endpoint is configured, and to provide clearer guidance to users. (src/Infinity.Toolkit.Azure/Configuration/ConfigurationBuilderExtensions.cs, [1] [2]

Diagnostics and Versioning:

  • Updated .editorconfig to suppress CS1587 warnings and incremented the version numbers for both the Azure and FeatureModules packages. (.editorconfig, src/Infinity.Toolkit.Azure/Infinity.Toolkit.Azure.csproj, src/Infinity.Toolkit.FeatureModules/Infinity.Toolkit.FeatureModules.csproj, [1] [2] [3]

Refactored the feature module system to use `IHostApplicationBuilder` instead of `WebApplicationBuilder` for improved compatibility with modern ASP.NET Core applications. Simplified module discovery and registration by moving logic from `ModuleUtilities` to `IHostApplicationBuilderExtensions`. Removed the `ModuleContext` and `ModuleUtilities` classes as they are no longer needed.

Updated `.editorconfig` to adjust diagnostic rule severities. Incremented the `VersionPrefix` in the project file to `1.4.0`. Improved logging to include module version information during registration.
Copilot AI review requested due to automatic review settings November 2, 2025 22:11
The `ModuleInfo` property in the `FeatureModule` class was updated from a nullable type (`IModuleInfo?`) to a non-nullable type (`IModuleInfo`). This change enforces stricter type safety by ensuring that the property always contains a valid `IModuleInfo` instance. The property is initialized with a `FeatureModuleInfo` instance, guaranteeing it is never `null`.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the feature modules infrastructure to consolidate module types and simplify the API. The main changes include merging IWebFeatureModule into IFeatureModule, removing the ModuleContext class, and renaming the extension class from WebApplicationBuilderExtensions to IHostApplicationBuilderExtensions.

  • Unified module interfaces: IWebFeatureModule now extends IFeatureModule instead of being a separate parallel interface
  • Changed RegisterModule signature to use IHostApplicationBuilder directly instead of a custom ModuleContext
  • Made ModuleInfo property non-nullable with a default version fallback

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ModuleUtilities.cs Deleted - functionality moved inline to IHostApplicationBuilderExtensions.cs
ModuleContext.cs Deleted - replaced with direct use of IHostApplicationBuilder
Infinity.Toolkit.FeatureModules.csproj Version bump from 1.3.0 to 1.4.0
IModuleInfo.cs Added default version "1.0.0" when version is null
IHostApplicationBuilderExtensions.cs Renamed class, changed extension methods to accept IHostApplicationBuilder, consolidated module discovery logic, unified module registration
IFeatureModule.cs Changed ModuleInfo to non-nullable, updated RegisterModule signature, made IWebFeatureModule extend IFeatureModule
FeatureModule.cs Updated to match new interface signatures
Infinity.Toolkit.Azure.csproj Version bump from 1.0.1 to 1.0.2
ConfigurationBuilderExtensions.cs Improved error handling with early validation and better warning messages
FeatureModulesSample/FeatureModule.cs Removed unnecessary RegisterModule override
.editorconfig Disabled CS1587 diagnostic
Comments suppressed due to low confidence (1)

src/Infinity.Toolkit.FeatureModules/IHostApplicationBuilderExtensions.cs:100


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@penyland penyland merged commit 90dd9e6 into main Nov 2, 2025
2 checks passed
@penyland penyland deleted the azure-app-conf-fixes branch November 2, 2025 22:20
@penyland penyland changed the title Azure app conf fixes Feature Modules Refactoring and API Improvements Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants