Fast.DynamicApplication
Public members, parameters, returns, and exceptions
Targets: net8.0;net9.0;net10.0.
Contract and constraints
Maps discovered application services to MVC APIs. AddDynamicApplication(string routePrefix = null) requires AddControllers() or AddControllersWithViews() first; missing ApplicationPartManager causes InvalidOperationException. MapControllers() is still required in the application pipeline. IDynamicApplication marks a discoverable service. Discovery follows the framework assembly scan, not every DLL in the process. Explicit routes in the example keep consumer URLs independent of naming conventions. ApiDescriptionSettingsAttribute controls names, groups, order and descriptions. The bool constructor changes API Explorer visibility through IgnoreApi; it is not an authorization boundary. Description supports HTML and needs a trusted source.
Installation and examples
Install the package
dotnet add package Fast.DynamicApplicationExample 1
using Fast.DynamicApplication;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Builder;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddDynamicApplication("api");
var app = builder.Build();
app.MapControllers();
app.Run();
[Route("api/sample")]
public sealed class SampleService : IDynamicApplication
{
[HttpGet("message")]
public string Message() => "hello";
}Web-host examples belong in a consumer project using Microsoft.NET.Sdk.Web and a supported .NET target. IaaS examples can be used in an ordinary class library. Registration precedes builder.Build(); configure middleware and endpoints before app.Run(). Samples retain their original code and comments. No host, external service, database operation or client generator was run, and these snippets have not been compiled in this update.
