🚀 Feature: Platform-Agnostic Plugin Configuration via IContainer + Optional Host Context
Summary
Refactor the plugin system to support cross-platform compatibility by introducing a unified Configure method that uses dependency injection (IContainer) and an optional host parameter for platform-specific needs.
Problem
The current plugin model uses platform-bound signatures such as:
Task Configure(WebApplication app)
This introduces a hard dependency on Microsoft.AspNetCore.App, which causes build failures on unsupported platforms (e.g., android-x64 in .NET MAUI). Since plugins are intended to be shared across platforms (Web + MAUI), we need a way to configure them without leaking host-specific types into the shared core.
Proposed Solution
Replace the platform-specific Configure() method with a platform-neutral version:
public virtual Task Configure(IContainer container, object? host)
IContainer provides access to all services registered by the host
host is an optional object that may be:
WebApplication (in Web)
MauiAppBuilder (in MAUI)
- or
null, depending on the platform
- Plugin authors can perform explicit type checks or casts based on what they need
Example usage:
public override async Task Configure(IContainer container, object? host)
{
if (host is WebApplication app)
{
await app.UseMigration<MyContext>();
}
var factory = container.GetInstance<IDbContextFactory<MyContext>>();
var context = await factory.CreateDbContextAsync();
await context.RunMigration();
}
In the host project, plugin execution becomes explicit:
foreach (var plugin in container.GetAllInstances<IPlugin>())
{
await plugin.Configure(container, app); // `app` can be WebApplication, MauiAppBuilder, etc.
}
This keeps plugin logic centralized and platform-neutral while still allowing platform-specific behavior when needed.
Benefits
- ✅ Avoids cross-platform build failures
- ✅ Keeps
LowlandTech.Core completely platform-agnostic
- ✅ Single plugin class supports multiple environments
- ✅ Host control stays explicit
- ✅ No
#if directives or runtime checks are required unless desired
Status
🚀 Feature: Platform-Agnostic Plugin Configuration via
IContainer+ Optional Host ContextSummary
Refactor the plugin system to support cross-platform compatibility by introducing a unified
Configuremethod that uses dependency injection (IContainer) and an optionalhostparameter for platform-specific needs.Problem
The current plugin model uses platform-bound signatures such as:
This introduces a hard dependency on
Microsoft.AspNetCore.App, which causes build failures on unsupported platforms (e.g.,android-x64in .NET MAUI). Since plugins are intended to be shared across platforms (Web + MAUI), we need a way to configure them without leaking host-specific types into the shared core.Proposed Solution
Replace the platform-specific
Configure()method with a platform-neutral version:IContainerprovides access to all services registered by the hosthostis an optional object that may be:WebApplication(in Web)MauiAppBuilder(in MAUI)null, depending on the platformExample usage:
In the host project, plugin execution becomes explicit:
This keeps plugin logic centralized and platform-neutral while still allowing platform-specific behavior when needed.
Benefits
LowlandTech.Corecompletely platform-agnostic#ifdirectives or runtime checks are required unless desiredStatus
Configure(IContainer container, object? host)inPluginbase class