UA.Tenet.Web
10.0.3
dotnet add package UA.Tenet.Web --version 10.0.3
NuGet\Install-Package UA.Tenet.Web -Version 10.0.3
<PackageReference Include="UA.Tenet.Web" Version="10.0.3" />
<PackageVersion Include="UA.Tenet.Web" Version="10.0.3" />
<PackageReference Include="UA.Tenet.Web" />
paket add UA.Tenet.Web --version 10.0.3
#r "nuget: UA.Tenet.Web, 10.0.3"
#:package UA.Tenet.Web@10.0.3
#addin nuget:?package=UA.Tenet.Web&version=10.0.3
#tool nuget:?package=UA.Tenet.Web&version=10.0.3
UA.Tenet.Web
UA.Tenet.Web is the ASP.NET Core host layer for Tenet. It keeps web startup opinionated but still overridable: service registration, middleware composition, minimal API discovery, MVC helpers, request extensions, and UI helpers all stay aligned around the same conventions.
Why this package exists
Use UA.Tenet.Web when the host needs:
- one convention-based entry point for API or MVC startup
- shared JSON, compression, localization, session, HSTS, and OpenAPI defaults
- automatic minimal API discovery from feature classes marked with
[TenetMinimal] - reusable MVC, Razor, and image helper behavior on top of the Tenet core package
Best fit
Use UA.Tenet.Web when you are building:
- an API host that wants Tenet defaults for OpenAPI, JSON, compression, localization, and endpoint discovery
- an MVC application that wants those API defaults plus controllers with views and Razor conventions
- a mixed host that serves controllers and minimal endpoints from the same application
- a host that wants the Tenet web boundary without moving domain and application logic out of
UA.Tenet
Package characteristics
- Targets
.NET 8,.NET 9, and.NET 10. - Builds on
UA.Tenetrather than replacing it. - Integrates Swagger and OpenAPI through
Swashbuckle.AspNetCore. - Ships XML documentation, SourceLink metadata, package symbols, and a package README.
Entry point map
| Entry point | Use it for | Current behavior |
|---|---|---|
AddTenetApi() |
API host service registration | Adds authorization, authentication, CORS, HttpClient, logging, API explorer, caches, response caching, session, localization, HSTS, Tenet JSON defaults, response compression, and Swagger generation |
AddTenetMvc() |
MVC and Razor host service registration | Builds on AddTenetApi(), then adds controllers with views, view localization, and Tenet Razor view-location conventions |
UseTenet() |
Runtime pipeline composition | Applies Swagger when enabled, proxy forwarding, HSTS, HTTPS redirection, localization, compression, static files, cookie policy, routing, CORS, session, authentication, authorization, and endpoint mapping |
MapTenetMinimals() |
Minimal API discovery | Scans loaded assemblies for [TenetMinimal], maps methods from ASP.NET Core HTTP attributes, defaults to GET, and groups endpoints by declaring type |
TenetWebOptions |
Pipeline overrides | Controls OpenAPI exposure, CORS, localization, static files, proxy forwarding, authentication, HTTPS redirection, and endpoint mapping |
Reusable web helpers
Beyond startup, the package includes helpers that keep common web behavior consistent:
ViewControllerfor title, description, and localizer-backed MVC controllersViewComponentBasefor convention-based component view namingActionExecutingContextExtensionandRazorPageBaseExtensionfor action and view convenience helpersHttpRequestExtensionfor CSV and XML content-type checksTenetImageTagHelperfor local SVG inlining and improved default image markup
Installation
dotnet add package UA.Tenet.Web
Quick start
API-first host
using Microsoft.OpenApi.Models;
using UA.Tenet.Web.Extensions;
using UA.Tenet.Web.Minimals;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddTenetApi(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "Orders API",
Version = "v1"
});
});
var app = builder.Build();
app.UseTenet(options =>
{
options.EndpointRouteBuilder = endpoints =>
endpoints.MapTenetMinimals(builder => builder.RequireAuthorization());
});
app.Run();
MVC host with controllers and minimals
using UA.Tenet.Agents.Extensions;
using UA.Tenet.Services.Extensions;
using UA.Tenet.Web.Extensions;
using UA.Tenet.Web.Minimals;
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddTenetServices()
.AddTenetAgents()
.AddTenetMvc();
var app = builder.Build();
app.UseTenet(options =>
{
options.EndpointRouteBuilder = endpoints =>
{
endpoints.MapTenetMinimals();
endpoints.MapControllers();
};
});
app.Run();
Add a minimal endpoint container
using Microsoft.AspNetCore.Mvc;
using UA.Tenet.Web.Minimals;
[TenetMinimal]
public static class DiagnosticsMinimal
{
[HttpGet("/api/health")]
public static IResult Get()
{
return Results.Ok(new { status = "ok" });
}
}
Use tag helpers where Tenet adds behavior
@addTagHelper *, UA.Tenet.Web
<img src="~/images/logo.svg" />
<img src="~/images/product.jpg" asp-append-version="true" alt="Product cover" />
Tune the pipeline
app.UseTenet(options =>
{
options.IsOpenApiEnabled = app.Environment.IsDevelopment();
options.CorsPolicyName = "Frontend";
options.RequestLocalizationOptions = localization =>
{
localization.SetDefaultCulture("en");
localization.AddSupportedCultures("en", "es");
localization.AddSupportedUICultures("en", "es");
};
options.EndpointRouteBuilder = endpoints => endpoints.MapTenetMinimals();
});
Important runtime behavior
AddTenetApi()configures both MVC JSON options and HTTP JSON options throughJson.SetTenetDefault().IsOpenApiEnableddefaults totrueonly whenASPNETCORE_ENVIRONMENTequalsDevelopment.UseTenet()always applies HSTS, and bothUseHttpsRedirectionandUseAuthenticationdefault totrue.- If
CorsPolicyNameis not set, the fallback CORS path is intentionally permissive. Prefer a named policy in production. AddTenetMvc()clears the default view locations and registers/{0}.cshtml,/Views/{1}/{0}.cshtml, and/Views/{0}.cshtml.MapTenetMinimals()scans assemblies already loaded into the currentAppDomain. Endpoint tags come from the declaring type name, and a trailingMinimalsuffix is removed.TenetImageTagHelperinlines local.svgfiles fromwwwroot. Other images remainimgtags and gain lazy loading, async decoding, and inferredalttext when those attributes are missing.
Relationship to UA.Tenet
UA.Tenet.Web is the web layer built on top of UA.Tenet. Keep business and integration logic in the core package, then compose the ASP.NET Core host with UA.Tenet.Web.
What to read next
- Package guide: https://docs.uadevs.org/tenet/ua-tenet-web
- Host bootstrap and OpenAPI: https://docs.uadevs.org/tenet/web-bootstrap-and-openapi
- Minimal API conventions: https://docs.uadevs.org/tenet/minimal-apis-and-route-conventions
- Getting started: https://docs.uadevs.org/tenet/getting-started
- Core package guide: https://docs.uadevs.org/tenet/ua-tenet
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
- Swashbuckle.AspNetCore (>= 10.1.7)
- UA.Tenet (>= 10.0.3)
-
net8.0
- Swashbuckle.AspNetCore (>= 10.1.7)
- UA.Tenet (>= 10.0.3)
-
net9.0
- Swashbuckle.AspNetCore (>= 10.1.7)
- UA.Tenet (>= 10.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
See https://docs.uadevs.org/tenet/web/release-notes for release notes and documentation.