Raptor.Common
0.0.10
dotnet add package Raptor.Common --version 0.0.10
NuGet\Install-Package Raptor.Common -Version 0.0.10
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="Raptor.Common" Version="0.0.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Raptor.Common" Version="0.0.10" />
<PackageReference Include="Raptor.Common" />
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 Raptor.Common --version 0.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Raptor.Common, 0.0.10"
#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 Raptor.Common@0.0.10
#: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=Raptor.Common&version=0.0.10
#tool nuget:?package=Raptor.Common&version=0.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Common Library (Raptor.Common)
Reusable library for building clean, decoupled, and resilient APIs on .NET 8.
Overview
This package provides:
- Result modeling (
Result,SuccessResult,FailureResult) - Error wrappers (
BusinessRuleException,ErrorList) - Clean Architecture interfaces (
IInteractor,IPresenter,IResponse, etc.) - Centralized HTTP client (
HttpApiClient) - Logging extensions for Serilog + Seq
Installation
Install from NuGet:
dotnet add package Raptor.Common
Or add to your .csproj:
<PackageReference Include="Raptor.Common" Version="x.y.z" />
Replace x.y.z with the latest version from NuGet.
Requirements
- .NET 8 SDK (net8.0)
- Compatible with ASP.NET Core, domain libraries, and microservices
Project structure (updated paths)
The library now lives at Common/ (previous nested paths were flattened).
Common/ core library
CleanArch/ clean architecture abstractions
Infra/HttpApi/ HTTP API client and responses
Logging/ Serilog + Seq extensions
Users/ sample user domain helpers
Common.Tests/ tests
Common.sln solution
Common/version version source for packaging
Usage
Result modeling
using Common;
Result<string> ok = Result.OK("All good");
Result<string> error = Result.Fail<string>("Something went wrong");
Clean Architecture interactor
using Common;
using Common.CleanArch;
public class GetUserInteractor : IResultInteractor<GetUserRequest, UserDto>
{
public Task<Result<UserDto>> Handle(GetUserRequest request, CancellationToken cancellationToken)
{
if (request.Id <= 0)
return Task.FromResult(Result.Fail<UserDto>("Invalid ID"));
var user = new UserDto { Id = request.Id, Name = "Example" };
return Task.FromResult(Result.OK(user));
}
}
Centralized HTTP client
using Common.Infra.HttpApi;
var client = new HttpApiClient("https://api.example.com/");
var response = await client.GetAsync<MyResponse>("endpoint");
Logging (Serilog + Seq)
appsettings.json:
"CustomLogging": {
"Project": "MyApiProject",
"SeqUri": "http://localhost:5341",
"LogEventLevel": "Information"
}
Registration:
using Common.Logging;
builder.Services.AddLoggingServices(configuration);
Versioning and releases
- PackageId:
Raptor.Common - Version source:
Common/version(used byCommon/Common.csproj) - Recommended tags:
vX.Y.Z(matching the NuGet package version)
Release checklist
- Update
Common/versionandCHANGELOG.md. - Run
dotnet test Common.sln. - Run
dotnet pack Common/Common.csproj -c Release. - Tag the commit:
git tag vX.Y.Z. - Push branch and tags.
Git flow (adjusted)
main: stable, published codedevelop: integration branchfeature/*: new workfix/*orhotfix/*: urgent fixeslegacy/*: legacy snapshots (for examplelegacy/common-legacy)- Release tags:
vX.Y.Z
Contributions
This is an internal package. Issues and PRs are welcome for improvements.
License
MIT (per package metadata).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- MediatR (>= 12.5.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Logging (>= 9.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.4)
- Newtonsoft.Json (>= 13.0.3)
- Serilog (>= 4.2.0)
- Serilog.Extensions.Logging (>= 9.0.1)
- Serilog.Sinks.Seq (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.