BluQube 1.0.0
dotnet add package BluQube --version 1.0.0
NuGet\Install-Package BluQube -Version 1.0.0
<PackageReference Include="BluQube" Version="1.0.0" />
<PackageVersion Include="BluQube" Version="1.0.0" />
<PackageReference Include="BluQube" />
paket add BluQube --version 1.0.0
#r "nuget: BluQube, 1.0.0"
#addin nuget:?package=BluQube&version=1.0.0
#tool nuget:?package=BluQube&version=1.0.0
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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- 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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net9.0
- BluQube.SourceGeneration (>= 1.0.0)
- FluentValidation (>= 12.0.0)
- MaybeMonad (>= 1.0.1.1)
- MediatR (>= 12.5.0)
- MediatR.Behaviors.Authorization (>= 12.5.0)
- Microsoft.Extensions.Http (>= 9.0.5)
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.0.0 | 92 | 6/20/2025 |