ServerComponentsExtensions Type

Extension methods to enable support for hosting server-side and WebAssembly Bolero components in ASP.NET Core.

Static members

Static member Description

ServerComponentsExtensions.AddBoleroHost(this, ?server, ?prerendered, ?devToggle)

Full Usage: ServerComponentsExtensions.AddBoleroHost(this, ?server, ?prerendered, ?devToggle)

Parameters:
    this : IServiceCollection
    ?server : bool - If true, use server-side Bolero; if false, use WebAssembly. Default is false.
    ?prerendered : bool - If true, prerender the initial view in the served HTML. Default is true.
    ?devToggle : bool - If true and ASP.NET Core is running in development environment, query parameter ?server=bool can be passed to use the given mode.

Returns: IServiceCollection

Configure the hosting of server-side and WebAssembly Bolero components.

this : IServiceCollection
?server : bool

If true, use server-side Bolero; if false, use WebAssembly. Default is false.

?prerendered : bool

If true, prerender the initial view in the served HTML. Default is true.

?devToggle : bool

If true and ASP.NET Core is running in development environment, query parameter ?server=bool can be passed to use the given mode.

Returns: IServiceCollection

ServerComponentsExtensions.BoleroPage(_this, page)

Full Usage: ServerComponentsExtensions.BoleroPage(_this, page)

Parameters:
Returns: BoleroPageResult

Create a HTML page from the given Bolero element as MVC content.

_this : Controller
page : Node

The page to return.

Returns: BoleroPageResult

ServerComponentsExtensions.MapFallbackToBolero(this, page)

Full Usage: ServerComponentsExtensions.MapFallbackToBolero(this, page)

Parameters:
Returns: IEndpointConventionBuilder

Adds a route endpoint that will match requests for non-file-names with the lowest possible priority. The request will be routed to a Bolero page.

this : IEndpointRouteBuilder
page : HttpContext -> Node

A function that generates the page to serve.

Returns: IEndpointConventionBuilder

ServerComponentsExtensions.MapFallbackToBolero(this, page)

Full Usage: ServerComponentsExtensions.MapFallbackToBolero(this, page)

Parameters:
Returns: IEndpointConventionBuilder

Adds a route endpoint that will match requests for non-file-names with the lowest possible priority. The request will be routed to a Bolero page.

this : IEndpointRouteBuilder
page : Node

The page to serve.

Returns: IEndpointConventionBuilder

ServerComponentsExtensions.RenderBoleroScript(html, config)

Full Usage: ServerComponentsExtensions.RenderBoleroScript(html, config)

Parameters:
Returns: IHtmlContent

Render the JavaScript tag needed by Bolero in a Razor page.

html : IHtmlHelper
config : IBoleroHostConfig

The injected Bolero hosting configuration.

Returns: IHtmlContent

ServerComponentsExtensions.RenderComponentAsync(html, config, ?parameters)

Full Usage: ServerComponentsExtensions.RenderComponentAsync(html, config, ?parameters)

Parameters:
    html : IHtmlHelper - The injected HTML helper.
    config : IBoleroHostConfig - The injected Bolero hosting configuration.
    ?parameters : obj - An Object containing the parameters to pass to the component.

Returns: Task<IHtmlContent>

Render a Bolero component in a Razor page.

html : IHtmlHelper

The injected HTML helper.

config : IBoleroHostConfig

The injected Bolero hosting configuration.

?parameters : obj

An Object containing the parameters to pass to the component.

Returns: Task<IHtmlContent>

ServerComponentsExtensions.RenderComponentAsync(html, componentType, config, ?parameters)

Full Usage: ServerComponentsExtensions.RenderComponentAsync(html, componentType, config, ?parameters)

Parameters:
    html : IHtmlHelper - The injected HTML helper.
    componentType : Type - The Bolero component type.
    config : IBoleroHostConfig - The injected Bolero hosting configuration.
    ?parameters : obj - An Object containing the parameters to pass to the component.

Returns: Task<IHtmlContent>

Render a Bolero component in a Razor page.

html : IHtmlHelper

The injected HTML helper.

componentType : Type

The Bolero component type.

config : IBoleroHostConfig

The injected Bolero hosting configuration.

?parameters : obj

An Object containing the parameters to pass to the component.

Returns: Task<IHtmlContent>

ServerComponentsExtensions.RenderPage(this, page)

Full Usage: ServerComponentsExtensions.RenderPage(this, page)

Parameters:
Returns: Task

Render the given page in the HTTP response body.

this : HttpContext
page : Node

The page to render.

Returns: Task