BrandUp.Core
10.0.2
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
<PackageReference Include="BrandUp.Core" Version="10.0.2" />
<PackageVersion Include="BrandUp.Core" Version="10.0.2" />
<PackageReference Include="BrandUp.Core" />
paket add BrandUp.Core --version 10.0.2
#r "nuget: BrandUp.Core, 10.0.2"
#:package BrandUp.Core@10.0.2
#addin nuget:?package=BrandUp.Core&version=10.0.2
#tool nuget:?package=BrandUp.Core&version=10.0.2
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 | Versions 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.4)
- Microsoft.Extensions.Options (>= 10.0.4)
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 |