Modrich.Abstractions
0.1.0
dotnet add package Modrich.Abstractions --version 0.1.0
NuGet\Install-Package Modrich.Abstractions -Version 0.1.0
<PackageReference Include="Modrich.Abstractions" Version="0.1.0" />
<PackageVersion Include="Modrich.Abstractions" Version="0.1.0" />
<PackageReference Include="Modrich.Abstractions" />
paket add Modrich.Abstractions --version 0.1.0
#r "nuget: Modrich.Abstractions, 0.1.0"
#:package Modrich.Abstractions@0.1.0
#addin nuget:?package=Modrich.Abstractions&version=0.1.0
#tool nuget:?package=Modrich.Abstractions&version=0.1.0
Modrich.Abstractions
Tier 1 contracts for the Modrich modular foundation for .NET 10. Module authors and host authors both depend on this package; nothing in it pulls EF Core, MVC, or any concrete framework beyond Microsoft.AspNetCore.App.
What's in the box
- Module contracts
IModule— base interface (Name, optionalPermissions).IApiModule— addsRegisterApiDependencies(IServiceCollection, IConfiguration).IAppModule— addsRegisterAppDependencies(...), optionalConfigureAppPipeline(WebApplication)andMapAppEndpoints(IEndpointRouteBuilder)hooks.
- Discovery marker
[assembly: ModuleAssembly](ModuleAssemblyAttribute) — opts a module assembly into host discovery. Apply once per module assembly.
- Persistence hooks
IModuleMigrator—Order,MigrateAsync(IServiceProvider).IModuleSeeder—Order,SeedAsync(IServiceProvider).
- Registry
IModuleRegistry/ModuleDescriptor(Name, Permissions)— read-only catalog of discovered modules.ModuleEntry— optional per-module config (ApiBaseUrl).
- Layout slots
LayoutSections—TopLeft,TopRight,SidebarTop,SidebarBottom,Footer.IModuleLayoutWidget/ModuleLayoutWidget(Type)— register a component the host renders via<DynamicComponent>.
Install
dotnet add package Modrich.Abstractions
Usage — declare an API module
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Modrich.Modules;
[assembly: ModuleAssembly]
namespace Acme.Orders;
public sealed class OrdersApiModule : IApiModule
{
public string Name => "Orders";
public IEnumerable<string> Permissions => ["Orders.View", "Orders.Edit"];
public void RegisterApiDependencies(IServiceCollection services, IConfiguration configuration)
{
services.AddScoped<IOrderService, OrderService>();
}
}
Usage — declare an App (UI) module
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Modrich.Modules;
[assembly: ModuleAssembly]
namespace Acme.Orders.Web;
public sealed class OrdersAppModule : IAppModule
{
public string Name => "Orders";
public void RegisterAppDependencies(IServiceCollection services, IConfiguration configuration, string? apiBaseUrl = null)
{
services.AddRefitClient<IOrdersApi>()
.ConfigureHttpClient(c => c.BaseAddress = new Uri(apiBaseUrl!));
}
public void ConfigureAppPipeline(WebApplication app) { /* optional */ }
public void MapAppEndpoints(IEndpointRouteBuilder endpoints) { /* optional */ }
}
Usage — module-owned EF migrations and seed data
public sealed class OrdersMigrator : IModuleMigrator
{
public int Order => 100;
public async Task MigrateAsync(IServiceProvider services)
{
var db = services.GetRequiredService<OrdersDbContext>();
await db.Database.MigrateAsync();
}
}
public sealed class OrdersSeeder : IModuleSeeder
{
public int Order => 100;
public Task SeedAsync(IServiceProvider services) => Task.CompletedTask;
}
The host runs every IModuleMigrator then every IModuleSeeder in ascending Order. See Modrich.Persistence.
Versioning
Strict semver. No breaking changes within a major version — modules built against vN.x must keep loading against vN.y where y > x. EnablePackageValidation is on.
Related packages
Modrich.Modularity— discovery + DI registration pipeline that consumes these contracts.Gatekeep.Authorization.Abstractions— permission contracts referenced byIModule.Permissions.Modrich.Sdk.Api/Modrich.Sdk.Web— meta-packages that pull this in for module authors.
License
MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Modrich.Abstractions:
| Package | Downloads |
|---|---|
|
Modrich.Modularity
Package Description |
|
|
Modrich.Sdk.Web
Package Description |
|
|
Modrich.Sdk.Api
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.