BluQube.SourceGeneration 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package BluQube.SourceGeneration --version 1.0.0
                    
NuGet\Install-Package BluQube.SourceGeneration -Version 1.0.0
                    
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="BluQube.SourceGeneration" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BluQube.SourceGeneration" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="BluQube.SourceGeneration" />
                    
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 BluQube.SourceGeneration --version 1.0.0
                    
#r "nuget: BluQube.SourceGeneration, 1.0.0"
                    
#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 BluQube.SourceGeneration@1.0.0
                    
#: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=BluQube.SourceGeneration&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=BluQube.SourceGeneration&version=1.0.0
                    
Install as a Cake Tool

BluQube

BluQube is a framework for Blazor to help with the write once, run on Server or WASM approach.

Overview

BluQube provides a unified development experience for Blazor applications, allowing you to write your application logic once and deploy it to both Blazor Server and Blazor WebAssembly without modification. The framework includes command and query handling patterns with built-in validation and error handling.

Features

  • Unified Blazor Development: Write once, run on both Server and WASM
  • Command & Query Pattern: Built-in CQRS-style architecture
  • Validation Support: Integrated validation with detailed error reporting
  • Source Generation: Automated code generation for improved performance
  • Error Handling: Comprehensive error handling with structured error data

Quick Start

Installation

Install the BluQube package via NuGet:

dotnet add package BluQube

Basic Usage

Server side
// Handle the command
public class MyCommandHandler(IEnumerable<IValidator<MyCommandCommand>> validators, ILogger<MyCommandCommandHandler> logger)
    : ICommandHandler<MyCommand>(validators, logger)
{
    protected override Task<CommandResult> HandleInternal(AddTodoCommand request, CancellationToken cancellationToken)
    {
        // Your business logic here
        return Task.FromResult(CommandResult.Success());
    }
}

// Process the query
public class MyQueryProcessor() : IQueryProcessor<MyQuery, MyQueryResult>
{
    public Task<QueryResult<GMyQueryResult>> Handle(MyQuery request, CancellationToken cancellationToken)
    {
         return Task.FromResult(QueryResult<MyQueryResult>.Succeeded(new MyQueryResult()));
    }
}
Client side
// Define a command
[BluQubeCommand(Path = "commands/mycommand")]
public record MyCommand(string Name) : ICommand;

[BluQubeQuery(Path = "queries/myquery")]
public record MyQuery(string Name) : IQuery<MyQueryResult>;

public record MyQueryResult(string Info) : IQueryResult;

Core Concepts

Commands

Commands represent actions that modify application state. They return CommandResult objects that can indicate success, failure, or validation errors.

Queries

Queries retrieve data without modifying state, following the CQRS pattern.

Error Handling

BluQube provides structured error handling with BluQubeErrorData containing error codes and messages.

Validation

BluQube integrates validation using FluentValidation, allowing you to define validation rules for commands and queries.

Authorization

BluQube supports authorization checks for commands, ensuring that only authorized users can perform certain actions. This is performed using the Mediatr behavior MediatR.Behaviors.Authorization.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

License

This project is licensed under the terms specified in the LICENSE file.

Support

For questions, issues, or contributions, please visit the GitHub repository.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on BluQube.SourceGeneration:

Package Downloads
BluQube

BluQube is a framework for Blazor to help with the write once, run on Sever or WASM

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 133 8/21/2025
1.0.0 124 6/20/2025
0.0.0-alpha.0.30 98 6/20/2025