Caravel 0.34.0
dotnet add package Caravel --version 0.34.0
NuGet\Install-Package Caravel -Version 0.34.0
<PackageReference Include="Caravel" Version="0.34.0" />
<PackageVersion Include="Caravel" Version="0.34.0" />
<PackageReference Include="Caravel" />
paket add Caravel --version 0.34.0
#r "nuget: Caravel, 0.34.0"
#:package Caravel@0.34.0
#addin nuget:?package=Caravel&version=0.34.0
#tool nuget:?package=Caravel&version=0.34.0
Caravel 
This package does not have any external dependency and it brings all basic utilities that every application should handle such as application context or exceptions.
- IUserContext (User)
//Inject IUserContext on constructor.
IUserContext userContext = ...
//Get User Id of the current user.
userContext.UserId();
//Get TenantId of the current tenant. It is useful when dealing with multitenant applications.
userContext.TenantId();
- Handling Errors
var customRawError = new Error("invalid_password", ErrorType.Validation, "Password does not match.", "Password does not match with the username.", Severity.Low);
# recommendation: use the static method to generate errors.
public static Error BookNotFoundError(Guid id) => Error.NotFound("book_not_found", $"Book {id} does not exist.");
- Handling Exceptions
var databaseError = new Error("database_connection", ErrorType.Internal, "Cannot create database connection.", "The database is down.", Severity.Critical);
var exception = new CaravelException(databaseError, innerException);
- DateTime Clock
IClock clock = new DateTimeClock();
var nowUtc = clock.NowUtc();
- Json Serializers
var model = new Dto("Caravel");
var json = await model.SerializeAsync(JsonSerializerConfigurations.CamelCaseSerializer());
- Functional
Result - Use Results instead of throwing exceptions
var result = Result<string>.Success("Success Value")
.Map((success) => success.Length,
(error) => error.Message.Length
);
var result = Result<string>.Failure(new Error("code_error", ErrorType.Validation, "Failure Value"))
.Map((success) => success.Length,
(error) => error.Message.Length
);
Optional - Avoid Nulls using Optional Types
Optional<Product> result = await service.GetProductAsync(id);
return result switch {
Some<Product> p => Ok(p),
_ => NotFound()
};
Either - Improve your error handling by using Either<Error,Success>
Either.Right<Error, Product> result = await service.GetProductAsync(id);
return result.Fold(
(e) => new HttpError(e.Message),
(product) => Ok(product));
| 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
- Ulid (>= 1.4.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Caravel:
| Package | Downloads |
|---|---|
|
Caravel.AspNetCore
Caravel.AspNetCore is a package that contains common utilities for building asp.net core applications. |
|
|
Caravel.MediatR
Caravel.MediatR is a package that contains reusable behaviours (validation, logging). |
|
|
Caravel.EntityFramework
Caravel.EntityFramework contains extension methods that can be reuse across applications.. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.34.0 | 254 | 9/5/2025 |
| 0.33.0 | 420 | 12/6/2024 |
| 0.32.0 | 17,567 | 10/12/2024 |
| 0.31.0 | 144 | 10/12/2024 |
| 0.30.0 | 160 | 10/12/2024 |
| 0.29.0 | 192 | 10/12/2024 |
| 0.28.0 | 162 | 10/11/2024 |
| 0.27.0 | 519 | 10/2/2024 |
| 0.26.0 | 259 | 9/28/2024 |
| 0.25.0 | 244 | 8/20/2024 |
| 0.24.0 | 341 | 12/10/2023 |
| 0.23.0 | 194 | 12/10/2023 |
| 0.22.0 | 229 | 12/4/2023 |
| 0.21.0 | 2,958 | 10/2/2022 |
| 0.20.0 | 500 | 9/28/2022 |
| 0.19.0 | 552 | 9/24/2022 |
| 0.18.0 | 514 | 9/24/2022 |
| 0.17.0 | 780 | 9/24/2022 |
| 0.15.0 | 525 | 9/27/2021 |
| 0.14.0 | 682 | 4/10/2021 |
| 0.13.0 | 487 | 4/10/2021 |
| 0.12.0 | 817 | 11/21/2020 |
| 0.11.0 | 791 | 11/15/2020 |
| 0.10.0 | 800 | 10/27/2020 |
| 0.9.0 | 1,203 | 10/12/2020 |
| 0.8.0 | 1,450 | 5/29/2020 |
| 0.7.0 | 725 | 5/16/2020 |
| 0.6.0 | 559 | 4/24/2020 |
| 0.5.0 | 761 | 4/11/2020 |
| 0.4.2 | 765 | 4/11/2020 |
| 0.4.1 | 784 | 4/10/2020 |
| 0.4.0 | 955 | 1/27/2020 |
| 0.3.2 | 1,070 | 1/11/2020 |
| 0.3.1 | 770 | 1/11/2020 |
| 0.3.0 | 772 | 1/11/2020 |
| 0.2.2 | 890 | 1/4/2020 |
| 0.2.1 | 809 | 12/26/2019 |
| 0.2.0 | 818 | 12/26/2019 |
| 0.1.2 | 695 | 12/26/2019 |
| 0.1.1 | 694 | 12/24/2019 |
| 0.1.0 | 660 | 12/21/2019 |