Class Static
public static class ServiceCollectionExtensions

Namespace: Moka.Blazor.Json.Extensions

Extension methods for registering Moka JSON viewer services with the DI container.

Methods

NameDescription
AddMokaJsonViewer(IServiceCollection services) static Adds the Moka JSON viewer services to the service collection with default options.
AddMokaJsonViewer(IServiceCollection services, MokaJsonViewerOptions> configure) static Adds the Moka JSON viewer services to the service collection with the specified options.

AddMokaJsonViewer(IServiceCollection services)

IServiceCollection ServiceCollectionExtensions.AddMokaJsonViewer(IServiceCollection services)

Adds the Moka JSON viewer services to the service collection with default options.

Parameters

NameTypeDescription
servicesIServiceCollectionThe service collection.

Returns: The service collection for chaining.

AddMokaJsonViewer(IServiceCollection services, MokaJsonViewerOptions> configure)

IServiceCollection ServiceCollectionExtensions.AddMokaJsonViewer(IServiceCollection services, Action<MokaJsonViewerOptions> configure)

Adds the Moka JSON viewer services to the service collection with the specified options.

Parameters

NameTypeDescription
servicesIServiceCollectionThe service collection.
configureAction<Moka.Blazor.Json.Models.MokaJsonViewerOptions>An action to configure the MokaJsonViewerOptions.

Returns: The service collection for chaining.

View Source
/// <summary>
///     Extension methods for registering Moka JSON viewer services with the DI container.
/// </summary>
public static class ServiceCollectionExtensions
{
    /// <summary>
    ///     Adds the Moka JSON viewer services to the service collection with default options.
    /// </summary>
    /// <param name = "services">The service collection.</param>
    /// <returns>The service collection for chaining.</returns>
    public static IServiceCollection AddMokaJsonViewer(this IServiceCollection services) => services.AddMokaJsonViewer(_ =>
    {
    });
    /// <summary>
    ///     Adds the Moka JSON viewer services to the service collection with the specified options.
    /// </summary>
    /// <param name = "services">The service collection.</param>
    /// <param name = "configure">An action to configure the <see cref = "MokaJsonViewerOptions"/>.</param>
    /// <returns>The service collection for chaining.</returns>
    public static IServiceCollection AddMokaJsonViewer(this IServiceCollection services, Action<MokaJsonViewerOptions> configure)
    {
        services.Configure(configure);
        services.AddScoped<MokaJsonInterop>();
        return services;
    }
}
Was this page helpful?