RazorWireOptions Default { get; }
Source
Gets a default instance of RazorWireOptions with default configuration settings.
Provides extension methods for IEndpointRouteBuilder to map RazorWire endpoints.
IEndpointRouteBuilder MapRazorWire(this IEndpointRouteBuilder endpoints)
Source
Registers a Server-Sent Events (SSE) GET endpoint at the configured streams base path that streams messages for a named channel.
endpointsThe endpoint route builder to configure.The original IEndpointRouteBuilder instance.
The endpoint enforces channel subscription authorization, streams hub messages as SSE (each line emitted as a `data:` event), sends a 20-second heartbeat comment when idle, and unsubscribes on client disconnect.
Provides utility methods for string manipulation, specifically for generating safe identifiers.
string ToSafeId(string? input, bool appendHash = false)
Source
Produces a safe identifier by replacing disallowed characters with hyphens, collapsing consecutive hyphens, trimming edge hyphens, and defaulting to "id" for null, whitespace, or empty results. Optionally appends a short deterministic 4-character lowercase hex hash (prefixed with a hyphen) derived from the original input to ensure uniqueness.
inputThe source string to convert into a safe identifier.appendHashIf true, appends a short deterministic 4-character lowercase hex hash (prefixed with a hyphen).The sanitized identifier; if appendHash is true the value is suffixed with "-" and a 4-character lowercase hex hash.
string GetDeterministicHash(string input)
Source
Produces a short deterministic 4-character lowercase hexadecimal string derived from the SHA-256 hash of the input.
inputThe string to hash.A 4-character lowercase hexadecimal string.
Returns only the first 4 hex characters (16 bits) of the SHA-256 digest; collisions are possible.
Provides extension methods for registering RazorWire services into the IServiceCollection.
IServiceCollection AddRazorWire(this IServiceCollection services, Action<RazorWireOptions>? configure = null)
Source
Registers RazorWire options and default RazorWire services, including IRazorPartialRenderer, into the provided IServiceCollection.
servicesThe service collection to register RazorWire services into.configureOptional action to configure RazorWireOptions; if null, default options are used.The same IServiceCollection instance with RazorWire registrations added.
Represents configuration options for the RazorWire real-time streaming and caching system.
RazorWireOptions Default { get; }
Source
Gets a default instance of RazorWireOptions with default configuration settings.
RazorWireStreamOptions Streams { get; }
Source
Gets configuration options for real-time streams, such as the base path for stream connections.
RazorWireCacheOptions Caching { get; }
Source
Gets configuration options for output caching policies used by RazorWire.
RazorWireFormOptions Forms { get; }
Source
Gets configuration options for RazorWire-enhanced form submissions.
Represents configuration options for RazorWire real-time streams.
string BasePath { get; set; }
Source
Gets or sets the base path used for establishing stream connections. Defaults to "/_rw/streams".
Represents configuration options for RazorWire output caching.
string PagePolicyName { get; set; }
Source
Gets or sets the name of the output cache policy for full pages. Defaults to "rw-page".
string IslandPolicyName { get; set; }
Source
Gets or sets the name of the output cache policy for individual islands. Defaults to "rw-island".
Represents configuration options for failed rw-active form submissions.
These options control the package convention for server failures from enhanced forms. The global EnableFailureUx switch has highest precedence: when it is false, RazorWire skips request markers, runtime lifecycle events, default fallback rendering, and development anti-forgery diagnostics even if FailureMode or a form-level attribute asks for them. Leave the global switch enabled and use FailureMode or per-form data-rw-form-failure values when an app wants more targeted behavior.
bool EnableFailureUx { get; set; }
Source
Gets or sets a value indicating whether RazorWire emits failed-form request markers, lifecycle hooks, and default failure behavior. Defaults to true.
Set this to false only when the host app owns all failed-form UX. It is a hard kill switch and overrides FailureMode plus any per-form data-rw-form-failure setting.
RazorWireFormFailureMode FailureMode { get; set; }
Source
Gets or sets the package-level failed-form behavior. Defaults to RazorWireFormFailureMode.Auto.
Use RazorWireFormFailureMode.Auto for convention-over-configuration fallback UI, RazorWireFormFailureMode.Manual when the app listens to events and renders its own UI, and RazorWireFormFailureMode.Off when forms should opt into failure handling one at a time.
bool EnableDevelopmentDiagnostics { get; set; }
Source
Gets or sets a value indicating whether development-only diagnostics may be shown. Defaults to true; diagnostics are still emitted only when the host is running in Development.
Diagnostics appear only when failed-form UX is enabled, the app runs in Development, and the failure path can be identified as a RazorWire form request. Production responses stay generic even when this property is true.
string DefaultFailureMessage { get; set; }
Source
Gets or sets the safe default message used for generic failed form submissions.
Null, empty, and whitespace-only assignments are normalized back to RazorWire's safe fallback copy. Use a non-empty value for product-specific recovery language.
Defines the package-level failed-form behavior for rw-active forms.
This enum only applies when RazorWireFormOptions.EnableFailureUx is enabled. Per-form data-rw-form-failure values may narrow behavior for a specific form, but the global kill switch always wins. The numeric values are explicit because this public enum may be persisted, serialized, or bound by applications. New values should be appended without changing the values documented here.
Provides extension methods for MVC controllers to interact with RazorWire.
RazorWireStreamBuilder RazorWireStream(this Controller controller)
Source
Creates a RazorWireStreamBuilder bound to the specified controller.
controllerThe controller instance used to initialize the builder.A RazorWireStreamBuilder configured to operate with the given controller.
Provides an example of how JavaScript functionality can be wrapped in a .NET class for easy consumption.
jsRuntimeThe JS runtime used to invoke JavaScript functions.ValueTask<string?> Prompt(string message)
Source
Shows a browser prompt dialog with the specified message and returns the user's input as a string, or null if the dialog was dismissed.
messageThe message to display in the prompt dialog.The user's input as a string, or null if the dialog was dismissed.
ValueTask DisposeAsync()
Source
Disposes the loaded JavaScript module and releases associated JS resources.
If the module was never loaded, this method completes without action.
A web module that integrates RazorWire real-time streaming and output caching into the application.
void ConfigureWebOptions(StartupContext context, WebOptions options)
Source
Ensures the application's MVC support level is at least ControllersWithViews.
contextThe startup context for the web module.optionsWeb options to configure; may be modified to raise Mvc.MvcSupportLevel to ControllersWithViews if it is lower.void ConfigureServices(StartupContext context, IServiceCollection services)
Source
Registers RazorWire services, enables output caching, and configures output cache options to include RazorWire policies.
contextThe startup context for the current module initialization.servicesThe service collection to which RazorWire, output caching, and related options are added.void RegisterDependentModules(ModuleDependencyBuilder builder)
Source
Registers this module's dependencies with the provided dependency builder.
builderThe dependency builder used to declare other modules this module requires.void ConfigureHostBeforeServices(StartupContext context, Microsoft.Extensions.Hosting.IHostBuilder builder)
Source
Executes module-specific host configuration before application services are registered.
contextThe startup context providing environment and configuration for module initialization.builderThe host builder to apply pre-service host configuration to.The default implementation does nothing.
void ConfigureHostAfterServices(StartupContext context, Microsoft.Extensions.Hosting.IHostBuilder builder)
Source
Provides a hook to modify the host builder after services have been registered.
contextStartup context containing environment and module information.builderThe Microsoft.Extensions.Hosting.IHostBuilder to configure.void ConfigureWebApplication(StartupContext context, IApplicationBuilder app)
Source
Enables output caching in the application's request pipeline.
contextStartup context providing environment and configuration for module initialization.appApplication builder used to configure the HTTP request pipeline.void ConfigureEndpoints(StartupContext context, IEndpointRouteBuilder endpoints)
Source
Maps RazorWire HTTP endpoints into the application's endpoint route builder.
contextThe startup context providing environment and configuration for module initialization.endpointsThe endpoint route builder to which RazorWire routes will be added.In addition to the streaming endpoints, this maps assembly-embedded fallbacks for RazorWire's runtime scripts and package demo assets. Normal ASP.NET Core static web assets still serve these files first when their manifest is available; the endpoint fallback keeps package-hosted tools working when only compiled assemblies are present.
bool IncludeAsApplicationPart { get; }
Source
Gets a value indicating whether this module's assembly should be searched for MVC application parts. Returns true for RazorWire to enable its tag helpers and other components.