SinghaSpace.Razor 1.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package SinghaSpace.Razor --version 1.2.1
                    
NuGet\Install-Package SinghaSpace.Razor -Version 1.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SinghaSpace.Razor" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SinghaSpace.Razor" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="SinghaSpace.Razor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SinghaSpace.Razor --version 1.2.1
                    
#r "nuget: SinghaSpace.Razor, 1.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SinghaSpace.Razor@1.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SinghaSpace.Razor&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=SinghaSpace.Razor&version=1.2.1
                    
Install as a Cake Tool

SinghaSpace utility libraries for .net

Features

  • Firebase Auth Blazor
    • Support Firebase UI
    • Google, Email, LINE and custom authentication providers
  • Google Sheet Services (currently supports reading public sheets only)
  • More features coming soon...

Firebase Auth Blazor

Setup
  1. Install NuGet package
dotnet add package SinghaSpace.Razor
  1. Add service in Program.cs
builder.Services.AddSinghaSpaceRazorService(new FirebaseAppConfig()
{
    ApiKey = "{ApiKey}",
    AuthDomain = "{AuthDomain}",
});
  1. Add JavaScript and CSS in index.html or _Host.cshtml
<link href="_content/SinghaSpace.Razor/firebase-ui-auth.css" rel="stylesheet" />
<script src="_content/SinghaSpace.Razor/bundle.js"></script>
  1. Add using directive in _Imports.razor
@using SinghaSpace.Razor.Components
Usage
  1. Inject Firebase service into your components
@inject FirebaseBlazor Firebase
  1. Use FirebaseAuthUi component
<FirebaseAuthUi Context="ctx" Config="_config">
    <button class="btn btn-primary" @onclick="@(async () => { await ctx.SignOut("/auth"); })">
        @ctx.LoggedIn?.User.DisplayName Sign out
    </button>
</FirebaseAuthUi>
  1. Configure authentication providers
var config = new FirebaseUiConfig()
{
    SignInSuccessUrl = "/redirect-path",
    SignInOptions = new List<FirebaseAuthProvider>()
    {
        new GoogleAuthProvider(),
        new EmailAuthProvider(),
        new LineAuthProvider()
        {
            Scopes = ["profile"],
            CustomParameters = new Dictionary<string, object>()
            {
                { "prompt", "consent" }
            }
        }
    }
};
  1. Create custom authentication provider
public class CustomAuthProvider : FirebaseAuthProvider
{
    public CustomAuthProvider() : base("custom.com")  // provider ID
    {
        // Configure provider options
        Name = "Custom Provider";  // Display name
        ButtonColor = "#FF0000";   // Button background color
        IconUrl = "path/to/icon";  // Provider icon URL

        // Add custom scopes
        Scopes = new[] { "profile", "email" };

        // Add custom parameters
        CustomParameters = new Dictionary<string, object>()
        {
            { "prompt", "select_account" },
            { "custom_param", "value" }
        };
    }
}

// Usage in config
var config = new FirebaseUiConfig()
{
    SignInSuccessUrl = "/redirect-path",
    SignInOptions = new List<FirebaseAuthProvider>()
    {
        new CustomAuthProvider()
        {
            // Override default options if needed
            Scopes = ["custom_scope"],
        }
    }
};

Google Sheet Services

Usage
  1. Read as CSV
var csvData = await GoogleSheetsService.GetCsvFromPublicSheetAsync(sheetId, sheetName);
  1. Read as typed objects
var list = await GoogleSheetsService.GetFromPublicSheetAsync<T>(
    sheetId,
    sheetName,
    reader => { reader.Context.RegisterClassMap<TMap>(); }
);
Example
// Reading movies from a sheet
var movies = await GoogleSheetsService.GetFromPublicSheetAsync<Movie>(
    "your-sheet-id",
    "Sheet1",
    reader => { reader.Context.RegisterClassMap<MovieMap>(); }
);

License

MIT

Product 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.6.0 101 7/29/2025
1.5.1 125 12/25/2024
1.5.0 111 12/25/2024
1.4.1 118 12/23/2024
1.4.0 112 12/21/2024
1.3.0 115 12/17/2024
1.2.1 110 12/16/2024
1.2.0 106 12/15/2024
1.1.1 107 11/28/2024
1.1.0 100 11/28/2024
1.0.10 152 8/25/2024
1.0.9 118 5/30/2024
1.0.8 137 5/16/2024
1.0.7 133 5/16/2024
1.0.6 136 2/7/2024
1.0.5 138 2/7/2024
1.0.4 125 1/31/2024
1.0.3 123 1/30/2024
1.0.2 118 1/30/2024
1.0.1 107 1/30/2024
1.0.0 134 1/30/2024