SilverLABS.SilverSHELL.Core 1.0.0

SilverLABS.SilverSHELL.Core

Core utilities and base configuration for SilverSHELL applications.

Features

  • Configuration Options - Centralized application configuration
  • Service Extensions - Easy dependency injection setup
  • Shared Utilities - Common functionality across SilverSHELL packages
  • Base Interfaces - Standard contracts for SilverSHELL components

Installation

dotnet add package SilverLABS.SilverSHELL.Core

Quick Start

1. Configure Services

using SilverSHELL.Core.Extensions;

var builder = WebAssemblyHostBuilder.CreateDefault(args);

builder.Services.AddSilverShellCore(options =>
{
    options.DefaultApplicationTitle = "My Application";
    options.AutoClearOnNavigation = true;
    options.EnableNotifications = true;
    options.EnableAnalytics = false;
});

await builder.Build().RunAsync();

2. Use Configuration

@inject IOptions<SilverShellOptions> Options

<PageTitle>@Options.Value.DefaultApplicationTitle</PageTitle>

<h3>Application Settings</h3>
<ul>
    <li>Auto Clear: @Options.Value.AutoClearOnNavigation</li>
    <li>Notifications: @Options.Value.EnableNotifications</li>
    <li>Analytics: @Options.Value.EnableAnalytics</li>
</ul>

Configuration Options

SilverShellOptions

public class SilverShellOptions
{
    /// <summary>
    /// Default application title shown in browser tab
    /// </summary>
    public string DefaultApplicationTitle { get; set; } = "SilverSHELL Application";

    /// <summary>
    /// Automatically clear state when navigating between pages
    /// </summary>
    public bool AutoClearOnNavigation { get; set; } = true;

    /// <summary>
    /// Enable in-app notifications
    /// </summary>
    public bool EnableNotifications { get; set; } = true;

    /// <summary>
    /// Enable analytics tracking
    /// </summary>
    public bool EnableAnalytics { get; set; } = false;
}

Service Extensions

AddSilverShellCore

public static IServiceCollection AddSilverShellCore(
    this IServiceCollection services,
    Action<SilverShellOptions>? configure = null)

Registers core SilverSHELL services with optional configuration.

Example:

builder.Services.AddSilverShellCore(options =>
{
    options.DefaultApplicationTitle = "My App";
    options.EnableNotifications = true;
});

Best Practices

1. Use Configuration

Always configure SilverShellCore in your startup:

builder.Services.AddSilverShellCore(options =>
{
    options.DefaultApplicationTitle = builder.Configuration["AppTitle"] ?? "My Application";
});

2. Inject Options

Use IOptions<SilverShellOptions> for runtime configuration access:

@inject IOptions<SilverShellOptions> CoreOptions

@code {
    protected override void OnInitialized()
    {
        var title = CoreOptions.Value.DefaultApplicationTitle;
    }
}

3. Combine with Other Packages

SilverShell.Core works seamlessly with other SilverSHELL packages:

builder.Services.AddSilverShellCore();
builder.Services.AddSilverShellAuth();
builder.Services.AddSilverShellAMS();
builder.Services.AddSilverShellPWA();

Documentation

Support

License

This project is licensed under the MIT License.


Made with ❤️ by SilverLABS

No packages depend on SilverLABS.SilverSHELL.Core.

Version Downloads Last updated
1.0.0 228 10/06/2025