BridgingIT.DevKit.Common.Abstractions 9.0.9

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

bITDevKit

Empowering developers with modular components for modern application development, centered around Domain-Driven Design principles.

Our goal is to empower developers by offering modular components that can be easily integrated into your projects. Whether you're working with repositories, commands, queries, or other components, the bITDevKit provides flexible solutions that can adapt to your specific needs.

This repository includes the complete source code for the bITDevKit, along with a variety of sample applications located in the ./examples folder within the solution. These samples serve as practical demonstrations of how to leverage the capabilities of the bITDevKit in real-world scenarios. All components are available as nuget packages.

For the latest updates and release notes, please refer to the RELEASES.

Join us in advancing the world of software development with the bITDevKit!


Result.cs Overview

The Result class encapsulates the outcome of an operation, promoting an expressive and error-tolerant way to handle success and failure states.

The Result class is a central component designed to encapsulate the outcome of an operation, providing a way to represent both successful and failed operations. This class promotes a more expressive and error-tolerant approach to handling operation results, encouraging the explicit declaration of success or failure states.

Returning a Result

To return a Result from a method, you typically define the method to return Result or Result<T>, where T is the type of the value returned in case of success. Here is an example method returning a Result:

public Result PerformOperation()
{
    // Your logic here
    
    if (success)
    {
        return Result.Success();
    }
    else
    {
        return Result.Failure(new Error("Operation Failed"));
    }
}

Handling a Result

When you receive a Result from a method, you can handle it by checking its success or failure state. Here's an example:

var result = PerformOperation();

if (result.IsSuccess)
{
    // Handle success
}
else
{
    // Handle failure
    var error = result.Error;
    Console.WriteLine(error.Message);
}

Using Typed Results

Sometimes, you may want to return a result with a value. This is where Result<T> comes in handy:

public Result<int> CalculateSum(int a, int b)
{
    if (a < 0 || b < 0)
    {
        return Result.Failure<int>(new Error("Inputs must be non-negative"));
    }

    return Result.Success(a + b);
}

Handling a Result<T> involves extracting the value if the operation was successful:

var result = CalculateSum(5, 10);

if (result.IsSuccess)
{
    int sum = result.Value;
    Console.WriteLine($"Sum: {sum}");
}
else
{
    Console.WriteLine(result.Error.Message);
}

Typed Errors

Typed errors provide a more specific and structured way to handle different error scenarios. For example, the EntityNotFoundResultError class can be used to represent an error where an entity is not found:

EntityNotFoundResultError.cs:
public class EntityNotFoundResultError : Error
{
    public EntityNotFoundResultError(string entityName, object key)
        : base($"Entity '{entityName}' with key '{key}' was not found.")
    {
    }
}

You can return this typed error as follows:

public Result GetEntity(int id)
{
    var entity = repository.FindById(id);

    if (entity == null)
    {
        return Result.Failure(new EntityNotFoundResultError("EntityName", id));
    }

    return Result.Success(entity);
}

When handling the result, you can check if the error is of a specific type:

var result = GetEntity(1);

if (result.IsSuccess)
{
    // Handle success
}
else if (result.Error is EntityNotFoundResultError)
{
    var error = (EntityNotFoundResultError)result.Error;
    Console.WriteLine(error.Message);
}
else
{
    // Handle other errors
}

Other available typed errors are:

By using typed errors, you can create more expressive and manageable error handling in your application.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (14)

Showing the top 5 NuGet packages that depend on BridgingIT.DevKit.Common.Abstractions:

Package Downloads
BridgingIT.DevKit.Common.Utilities

BridgingIT DevKit: Empowering developers with modular components for modern application development, centered around Domain-Driven Design principles. Our goal is to empower developers by offering modular components that can be easily integrated into your projects. Whether you're working with repositories, commands, queries, or other components, the bITDevKit provides flexible solutions that can adapt to your specific needs.

BridgingIT.DevKit.Common.Serialization

BridgingIT DevKit: Empowering developers with modular components for modern application development, centered around Domain-Driven Design principles. Our goal is to empower developers by offering modular components that can be easily integrated into your projects. Whether you're working with repositories, commands, queries, or other components, the bITDevKit provides flexible solutions that can adapt to your specific needs.

BridgingIT.DevKit.Domain

BridgingIT DevKit: Empowering developers with modular components for modern application development, centered around Domain-Driven Design principles. Our goal is to empower developers by offering modular components that can be easily integrated into your projects. Whether you're working with repositories, commands, queries, or other components, the bITDevKit provides flexible solutions that can adapt to your specific needs.

BridgingIT.DevKit.Application.Storage

BridgingIT DevKit: Empowering developers with modular components for modern application development, centered around Domain-Driven Design principles. Our goal is to empower developers by offering modular components that can be easily integrated into your projects. Whether you're working with repositories, commands, queries, or other components, the bITDevKit provides flexible solutions that can adapt to your specific needs.

BridgingIT.DevKit.Application.Messaging

BridgingIT DevKit: Empowering developers with modular components for modern application development, centered around Domain-Driven Design principles. Our goal is to empower developers by offering modular components that can be easily integrated into your projects. Whether you're working with repositories, commands, queries, or other components, the bITDevKit provides flexible solutions that can adapt to your specific needs.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.0.10-preview.0.1 123 a month ago
9.0.9 253 a month ago
9.0.9-preview.0.1 113 a month ago
9.0.8 332 a month ago
9.0.7 355 a month ago
9.0.6 356 a month ago
9.0.6-preview.0.9 118 2 months ago
9.0.6-preview.0.6 128 2 months ago
9.0.6-preview.0.5 122 2 months ago
9.0.6-preview.0.3 83 2 months ago
9.0.5 705 2 months ago
9.0.5-preview.0.1 136 2 months ago
9.0.4 428 2 months ago
9.0.4-preview.0.4 209 2 months ago
9.0.4-preview.0.3 175 2 months ago
9.0.4-preview.0.2 158 2 months ago
9.0.4-preview.0.1 127 2 months ago
9.0.3 365 2 months ago
9.0.3-preview.0.1 136 2 months ago
9.0.2 375 3 months ago
9.0.2-preview.55 139 3 months ago
9.0.2-preview.54 161 3 months ago
9.0.2-preview.53 128 3 months ago
9.0.2-preview.51 125 3 months ago
9.0.2-preview.50 127 3 months ago
9.0.2-preview.49 142 3 months ago
9.0.2-preview.47 138 3 months ago
9.0.2-preview.46 124 3 months ago
9.0.2-preview.45 139 3 months ago
9.0.2-preview.44 169 3 months ago
9.0.2-preview.43 159 3 months ago
9.0.2-preview.42 154 3 months ago
9.0.2-preview.41 138 3 months ago
9.0.2-preview.39 55 3 months ago
9.0.2-preview.38 86 3 months ago
9.0.2-preview.37 100 3 months ago
9.0.2-preview.36 125 3 months ago
9.0.2-preview.35 136 3 months ago
9.0.2-preview.34 266 3 months ago
9.0.2-preview.33 268 3 months ago
9.0.2-preview.32 282 3 months ago
9.0.2-preview.31 268 3 months ago
9.0.2-preview.28 269 3 months ago
9.0.2-preview.25 264 3 months ago
9.0.2-preview.24 271 3 months ago
9.0.2-preview.23 268 3 months ago
9.0.2-preview.22 266 3 months ago
9.0.2-preview.21 292 3 months ago
9.0.2-preview.20 272 3 months ago
9.0.2-preview.19 266 3 months ago
9.0.2-preview.18 269 3 months ago
9.0.2-preview.16 222 3 months ago
9.0.2-preview.14 53 3 months ago
9.0.2-preview.13 54 3 months ago
9.0.2-preview.12 53 3 months ago
9.0.2-preview.5 73 3 months ago
9.0.2-preview.3 136 3 months ago
9.0.2-preview.2 131 3 months ago
9.0.2-preview.1 122 3 months ago
9.0.1-preview.0.335 245 4 months ago
9.0.1-preview.0.333 134 4 months ago
9.0.1-preview.0.332 127 4 months ago
9.0.1-preview.0.331 126 4 months ago
9.0.1-preview.0.329 51 4 months ago
9.0.1-preview.0.326 63 4 months ago
9.0.1-preview.0.324 51 4 months ago
9.0.1-preview.0.323 57 4 months ago
9.0.1-preview.0.321 79 4 months ago
9.0.1-preview.0.319 60 4 months ago
9.0.1-preview.0.318 71 4 months ago
9.0.1-preview.0.317 78 4 months ago
9.0.1-preview.0.316 82 4 months ago
9.0.1-preview.0.315 102 4 months ago
9.0.1-preview.0.314 87 4 months ago
9.0.1-preview.0.312 89 4 months ago
9.0.1-preview.0.309 126 4 months ago
9.0.1-preview.0.302 127 4 months ago
9.0.1-preview.0.301 167 4 months ago
9.0.1-preview.0.300 128 4 months ago
9.0.1-preview.0.299 135 4 months ago
9.0.1-preview.0.297 182 4 months ago
9.0.1-preview.0.296 137 3 months ago
9.0.1-preview.0.295 123 4 months ago
9.0.1-preview.0.294 130 4 months ago
9.0.1-preview.0.293 125 4 months ago
9.0.1-preview.0.290 132 4 months ago
9.0.1-preview.0.287 141 4 months ago
9.0.1-preview.0.286 230 4 months ago
9.0.1-preview.0.285 217 4 months ago
9.0.1-preview.0.279 210 4 months ago
9.0.1-preview.0.278 221 4 months ago
9.0.1-preview.0.277 217 4 months ago
9.0.1-preview.0.276 272 4 months ago
9.0.1-preview.0.274 132 4 months ago
9.0.1-preview.0.272 119 4 months ago
9.0.1-preview.0.271 117 4 months ago
9.0.1-preview.0.270 98 4 months ago
9.0.1-preview.0.267 124 4 months ago
9.0.1-preview.0.266 125 4 months ago
9.0.1-preview.0.265 133 4 months ago
9.0.1-preview.0.264 178 4 months ago
9.0.1-preview.0.263 128 4 months ago
9.0.1-preview.0.262 131 4 months ago
9.0.1-preview.0.261 136 4 months ago
9.0.1-preview.0.258 487 4 months ago
9.0.1-preview.0.255 97 4 months ago
9.0.1-preview.0.254 134 4 months ago
9.0.1-preview.0.253 126 4 months ago
9.0.1-preview.0.252 130 4 months ago
9.0.1-preview.0.251 127 4 months ago
9.0.1-preview.0.250 136 4 months ago
9.0.1-preview.0.247 144 4 months ago
9.0.1-preview.0.246 127 4 months ago
9.0.1-preview.0.244 163 5 months ago
9.0.1-preview.0.243 240 5 months ago
9.0.1-preview.0.242 168 5 months ago
9.0.1-preview.0.241 165 5 months ago
9.0.1-preview.0.239 165 5 months ago
9.0.1-preview.0.238 268 5 months ago
9.0.1-preview.0.237 225 5 months ago
9.0.1-preview.0.236 163 5 months ago
9.0.1-preview.0.235 143 5 months ago
9.0.1-preview.0.234 154 5 months ago
9.0.1-preview.0.233 179 5 months ago
9.0.1-preview.0.232 140 5 months ago
9.0.1-preview.0.231 140 5 months ago
9.0.1-preview.0.230 194 5 months ago
9.0.1-preview.0.229 155 5 months ago
9.0.1-preview.0.228 156 5 months ago
9.0.1-preview.0.227 149 5 months ago
9.0.1-preview.0.226 145 5 months ago
9.0.1-preview.0.220 178 6 months ago
9.0.1-preview.0.219 133 6 months ago
9.0.1-preview.0.218 132 6 months ago
9.0.1-preview.0.217 195 6 months ago
9.0.1-preview.0.215 156 6 months ago
9.0.1-preview.0.214 138 6 months ago
9.0.1-preview.0.213 156 6 months ago
9.0.1-preview.0.212 163 6 months ago
9.0.1-preview.0.211 137 6 months ago
9.0.1-preview.0.210 141 6 months ago
9.0.1-preview.0.209 154 6 months ago
9.0.1-preview.0.208 158 6 months ago
9.0.1-preview.0.206 141 6 months ago
9.0.1-preview.0.205 148 6 months ago
9.0.1-preview.0.204 145 6 months ago
9.0.1-preview.0.202 136 6 months ago
9.0.1-preview.0.199 73 6 months ago
9.0.1-preview.0.198 110 6 months ago
9.0.1-preview.0.196 118 6 months ago
9.0.1-preview.0.193 110 6 months ago
9.0.1-preview.0.189 137 6 months ago
9.0.1-preview.0.188 465 6 months ago
9.0.1-preview.0.187 477 6 months ago
9.0.1-preview.0.186 463 6 months ago
9.0.1-preview.0.185 466 6 months ago
9.0.1-preview.0.184 466 6 months ago
9.0.1-preview.0.183 464 6 months ago
9.0.1-preview.0.182 73 6 months ago
9.0.1-preview.0.180 124 6 months ago
9.0.1-preview.0.179 133 6 months ago
9.0.1-preview.0.178 131 6 months ago
9.0.1-preview.0.175 133 6 months ago
9.0.1-preview.0.174 133 6 months ago
9.0.1-preview.0.173 148 6 months ago
9.0.1-preview.0.172 295 6 months ago
9.0.1-preview.0.171 131 6 months ago
9.0.1-preview.0.170 130 6 months ago
9.0.1-preview.0.165 130 6 months ago
9.0.1-preview.0.162 139 6 months ago
9.0.1-preview.0.160 133 6 months ago
9.0.1-preview.0.152 111 6 months ago
9.0.1-preview.0.148 154 6 months ago
9.0.1-preview.0.147 134 6 months ago
9.0.1-preview.0.146 137 6 months ago
9.0.1-preview.0.145 143 6 months ago
9.0.1-preview.0.141 140 6 months ago
9.0.1-preview.0.140 181 6 months ago
9.0.1-preview.0.139 137 6 months ago
9.0.1-preview.0.138 152 6 months ago
9.0.1-preview.0.137 130 6 months ago
9.0.1-preview.0.135 147 6 months ago
9.0.1-preview.0.134 186 6 months ago
9.0.1-preview.0.133 178 6 months ago
9.0.1-preview.0.132 173 6 months ago
9.0.1-preview.0.130 175 6 months ago
9.0.1-preview.0.129 230 6 months ago
9.0.1-preview.0.128 181 6 months ago
9.0.1-preview.0.127 188 6 months ago
9.0.1-preview.0.125 194 6 months ago
9.0.1-preview.0.119 90 7 months ago
9.0.1-preview.0.118 71 7 months ago
9.0.1-preview.0.116 78 7 months ago
9.0.1-preview.0.112 68 7 months ago
9.0.1-preview.0.111 76 7 months ago
9.0.1-preview.0.110 124 7 months ago
9.0.1-preview.0.107 90 7 months ago
9.0.1-preview.0.106 81 7 months ago
9.0.1-preview.0.105 78 7 months ago
9.0.1-preview.0.104 84 7 months ago
9.0.1-preview.0.103 104 7 months ago
9.0.1-preview.0.102 100 7 months ago
9.0.1-preview.0.100 69 7 months ago
9.0.1-preview.0.99 110 7 months ago
9.0.1-preview.0.97 80 7 months ago
9.0.1-preview.0.96 75 7 months ago
9.0.1-preview.0.94 75 7 months ago
9.0.1-preview.0.93 104 7 months ago
9.0.1-preview.0.92 75 7 months ago
9.0.1-preview.0.91 67 7 months ago
9.0.1-preview.0.88 75 7 months ago
9.0.1-preview.0.87 257 7 months ago
9.0.1-preview.0.85 275 7 months ago
9.0.1-preview.0.84 216 7 months ago
9.0.1-preview.0.82 176 7 months ago
9.0.1-preview.0.79 183 7 months ago
9.0.1-preview.0.78 202 7 months ago
9.0.1-preview.0.77 178 7 months ago
9.0.1-preview.0.76 217 7 months ago
9.0.1-preview.0.73 206 7 months ago
9.0.1-preview.0.71 153 7 months ago
9.0.1-preview.0.70 198 7 months ago
9.0.1-preview.0.69 190 7 months ago
9.0.1-preview.0.67 198 7 months ago
9.0.1-preview.0.62 182 7 months ago
9.0.1-preview.0.58 89 7 months ago
9.0.1-preview.0.56 80 7 months ago
9.0.1-preview.0.55 66 7 months ago
9.0.1-preview.0.54 71 7 months ago
9.0.1-preview.0.53 66 7 months ago
9.0.1-preview.0.52 68 7 months ago
9.0.1-preview.0.50 85 7 months ago
9.0.1-preview.0.49 128 7 months ago
9.0.1-preview.0.47 69 7 months ago
9.0.1-preview.0.45 74 7 months ago
9.0.1-preview.0.43 76 7 months ago
9.0.1-preview.0.42 75 7 months ago
9.0.1-preview.0.41 76 7 months ago
9.0.1-preview.0.35 78 7 months ago
9.0.1-preview.0.20 73 8 months ago
9.0.1-preview.0.19 67 8 months ago
9.0.1-preview.0.18 71 8 months ago
9.0.1-preview.0.14 69 8 months ago
9.0.1-preview.0.13 78 8 months ago
9.0.1-preview.0.11 66 8 months ago
9.0.1-preview.0.10 65 8 months ago
9.0.1-preview.0.9 69 8 months ago
9.0.1-preview.0.2 126 8 months ago
3.0.5-preview.0.2 139 6 months ago
3.0.5-preview.0.1 91 7 months ago
3.0.4 517 8 months ago
3.0.4-preview.0.38 78 8 months ago
3.0.4-preview.0.37 115 9 months ago
3.0.4-preview.0.36 208 9 months ago
3.0.4-preview.0.34 81 9 months ago
3.0.4-preview.0.32 80 9 months ago
3.0.4-preview.0.31 98 10 months ago
3.0.4-preview.0.30 77 10 months ago
3.0.4-preview.0.29 70 10 months ago
3.0.4-preview.0.28 130 10 months ago
3.0.4-preview.0.27 73 10 months ago
3.0.4-preview.0.23 77 10 months ago
3.0.4-preview.0.21 65 10 months ago
3.0.4-preview.0.20 70 10 months ago
3.0.4-preview.0.19 78 10 months ago
3.0.4-preview.0.18 65 10 months ago
3.0.4-preview.0.17 68 10 months ago
3.0.4-preview.0.16 74 11/15/2024
3.0.4-preview.0.15 69 11/15/2024
3.0.4-preview.0.14 88 11/2/2024
3.0.4-preview.0.13 82 10/29/2024
3.0.4-preview.0.12 74 10/29/2024
3.0.4-preview.0.8 80 10/29/2024
3.0.4-preview.0.7 80 10/29/2024
3.0.4-preview.0.6 71 10/24/2024
3.0.4-preview.0.5 81 10/23/2024
3.0.4-preview.0.4 71 10/23/2024
3.0.4-preview.0.3 71 10/23/2024
3.0.4-preview.0.2 76 10/23/2024
3.0.4-preview.0.1 214 10/16/2024
3.0.3 400 10/11/2024
3.0.3-preview.0.56 88 10/10/2024
3.0.3-preview.0.55 81 10/10/2024
3.0.3-preview.0.54 85 10/10/2024
3.0.3-preview.0.50 81 10/10/2024
3.0.3-preview.0.49 96 10/9/2024
3.0.3-preview.0.44 100 10/8/2024
3.0.3-preview.0.43 79 10/8/2024
3.0.3-preview.0.42 78 10/7/2024
3.0.3-preview.0.41 79 10/7/2024
3.0.3-preview.0.40 114 10/1/2024
3.0.3-preview.0.39 82 10/1/2024
3.0.3-preview.0.38 79 10/1/2024
3.0.3-preview.0.36 84 9/30/2024
3.0.3-preview.0.35 98 9/26/2024
3.0.3-preview.0.34 91 9/26/2024
3.0.3-preview.0.33 80 9/26/2024
3.0.3-preview.0.32 107 9/24/2024
3.0.3-preview.0.31 797 9/10/2024
3.0.3-preview.0.30 76 9/9/2024
3.0.3-preview.0.29 73 9/9/2024
3.0.3-preview.0.28 65 9/8/2024
3.0.3-preview.0.27 86 9/5/2024
3.0.3-preview.0.26 83 9/3/2024
3.0.3-preview.0.25 80 9/3/2024
3.0.3-preview.0.24 87 9/3/2024
3.0.3-preview.0.23 99 8/21/2024
3.0.3-preview.0.22 69 7/29/2024
3.0.3-preview.0.21 86 7/25/2024
3.0.3-preview.0.18 86 7/12/2024
3.0.3-preview.0.17 81 7/12/2024
3.0.3-preview.0.16 75 7/12/2024
3.0.3-preview.0.15 74 7/5/2024
3.0.3-preview.0.14 141 6/24/2024
3.0.3-preview.0.13 102 6/23/2024
3.0.3-preview.0.12 93 6/21/2024
3.0.3-preview.0.11 100 6/20/2024
3.0.3-preview.0.9 375 5/27/2024
3.0.3-preview.0.8 85 5/27/2024
3.0.3-preview.0.7 113 5/17/2024
3.0.3-preview.0.6 88 5/14/2024
3.0.3-preview.0.5 356 5/8/2024
3.0.3-preview.0.3 114 5/6/2024
3.0.3-preview.0.1 101 4/25/2024
3.0.2 1,373 4/25/2024
3.0.2-preview.0.4 108 4/25/2024
3.0.2-preview.0.3 162 4/25/2024
3.0.2-preview.0.2 110 4/25/2024
3.0.2-preview.0.1 85 4/25/2024
3.0.1 450 4/25/2024
3.0.1-preview.0.10 96 4/24/2024
3.0.1-preview.0.9 197 4/19/2024
3.0.1-preview.0.8 81 4/24/2024
3.0.1-preview.0.7 148 4/24/2024

## Release 3.0.1 [25.04.24]

- [N] Initial release

-----

- [N] New
- [M] Modified
- [B] Breaking