BrandUp.Core 10.0.2

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

BrandUp.Core

Base framework for .NET development.

  • Universal result structure
  • CQRS infrastructure

Qieries


public class UserByPhoneQuery : IQuery<User>
{
    [Required]
    public string Phone { get; set; }
}

public class UserByPhoneQueryHandler : IQueryHandler<UserByPhoneQuery, User>
{
    public Task<IList<User>> HandleAsync(UserByPhoneQuery query, CancellationToken cancellationToken = default)
    {
        var result = new List<User>
        {
            new User
            {
                Id = System.Guid.NewGuid(),
                Phone = query.Phone
            }
        };

        return Task.FromResult<IList<User>>(result);
    }
}

serviceCollection.AddDomain(options =>
    {
        options.AddQuery<UserByPhoneQuery>();
    })
    .AddValidator<ComponentModelValidator>();

var userByPhoneResult = await domain.ReadAsync(new UserByPhoneQuery { Phone = "89232229022" });

// userByPhoneResult.IsSuccess
// userByPhoneResult.Errors
// userByPhoneResult.Data
// userByPhoneResult.Data[0]

Commands


public class SignUpCommandHandler : ICommandHandler<SignUpCommand, SignUpResult>
{
    readonly IUserRepository userRepository;

    public SignUpCommandHandler(IUserRepository userRepository)
    {
        this.userRepository = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
    }

    public async Task<SignUpResult> HandleAsync(SignUpCommand command, CancellationToken cancellationToken = default)
    {
        var user = new User
            {
                Id = System.Guid.NewGuid(),
                Phone = command.Phone
            };

        await userRepository.CreateAsync(user, cancellationToken);

        var result = new SignUpResult
        {
            User = user
        };

        return result;
    }
}

public class SignUpCommand : ICommand<SignUpResult>
{
    [Required]
    public string Phone { get; set; }
}

public class SignUpResult
{
    public User User { get; set; }
}

serviceCollection.AddDomain(options =>
    {
        options.AddCommand<SignUpCommandHandler>();
        options.AddCommand<VisitUserCommandHandler>();
        options.AddCommand<ChangeUserPhoneCommandHandler>();
    })
    .AddValidator<ComponentModelValidator>();

var domain = serviceProvider.GetRequiredService<IDomain>();
var signUpResult = await domain.SendAsync(new Example.Commands.SignUpCommandHandler { Phone = "+79231145449" });

// signUpResult.IsSuccess
// signUpResult.Errors
// signUpResult.Data

Items


public class User : IItem<Guid>
{
    public Guid Id { get; set; }
    public string Phone { get; set; }
}

public class UserProvider : IItemProvider<Guid, User>
{
    public Task<User> FindByIdASync(Guid itemId, CancellationToken cancellationToken = default)
    {
        return Task.FromResult(new User { Id = new Guid("0b1eb946-c07c-406c-a7ba-d56b007c830a"), Phone = "79232229022" });
    }
}

public class VisitUserCommand : IItemCommand<Items.User> { }

public class VisitUserCommandHandler : IItemCommandHandler<Items.User, VisitUserCommand>
{
    public Task<Result> HandleAsync(Items.User item, VisitUserCommand command, CancellationToken cancellationToken = default)
    {
        return Task.FromResult(Result.Success());
    }
}

serviceCollection.AddDomain(options =>
    {
        options.AddCommand<Example.Commands.VisitUserCommandHandler>();
    })
    .AddItemProvider<UserProvider>();

var domain = serviceProvider.GetRequiredService<IDomain>();
var item = await domain.FindItem<Guid, User>(new Guid("0b1eb946-c07c-406c-a7ba-d56b007c830a"));

var userProvider1 = serviceProvider.GetService<UserProvider>();
var userProvider2 = serviceProvider.GetService<IItemProvider<Guid, User>>();

var result = await domain.SendItemAsync(new Guid("0b1eb946-c07c-406c-a7ba-d56b007c830a"), new Example.Commands.VisitUserCommand());
var result = await domain.SendItemAsync(item, new Example.Commands.VisitUserCommand());

Results


Result.Success()
Result.Success<TData>(data)
Result.Error("code", "message")
Result.Error<TData>("code", "message")
Result.Error(...errors)
Result.Error<TData>(...errors)

// result.IsSuccess
// result.Errors
// result.Data

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (4)

Showing the top 4 NuGet packages that depend on BrandUp.Core:

Package Downloads
BrandUp.Core.Testing

Test helpers for BrandUp.Core: a domain test host, dispatch and Result assertions, event capture, fake transactions and a fake event outbox. Framework-agnostic — works with xUnit, NUnit and MSTest.

BrandUp.Core.AspNetCore

ASP.NET Core integration for BrandUp.Core: maps Result to HTTP responses and ProblemDetails, for both minimal APIs and MVC.

BrandUp.Core.FluentValidation

FluentValidation adapter for BrandUp.Core: runs the FluentValidation validators registered for a dispatched query or command inside the domain validation pipeline.

BrandUp.Core.Outbox.MongoDB

MongoDB transactional outbox for BrandUp.Core domain events: a store that persists deferred events inside the command's transaction and a background processor delivering them after commit with retries.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.2.5 182 9/29/2026
10.2.3 302 9/9/2026
10.2.1 218 8/23/2026
10.1.2 199 8/22/2026
10.1.1 197 8/22/2026
10.0.8 149 8/21/2026
10.0.7 206 7/4/2026
10.0.6 182 5/28/2026
10.0.5 184 4/27/2026
10.0.4 177 4/20/2026
10.0.3 239 3/16/2026
10.0.2 174 3/11/2026
10.0.1 250 1/3/2026
2.0.5 395 7/1/2025
2.0.4 501 6/10/2025
2.0.3 367 3/29/2025
2.0.2 391 3/9/2025
2.0.1 338 12/15/2024
1.2.1 360 7/9/2024
1.1.3 383 4/29/2024
Loading failed