BridgingIT.DevKit.Common.Abstractions 9.0.1-preview.0.97

This is a prerelease version of BridgingIT.DevKit.Common.Abstractions.
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.1-preview.0.97
                    
NuGet\Install-Package BridgingIT.DevKit.Common.Abstractions -Version 9.0.1-preview.0.97
                    
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.1-preview.0.97" />
                    
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.1-preview.0.97" />
                    
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.1-preview.0.97
                    
#r "nuget: BridgingIT.DevKit.Common.Abstractions, 9.0.1-preview.0.97"
                    
#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.
#addin nuget:?package=BridgingIT.DevKit.Common.Abstractions&version=9.0.1-preview.0.97&prerelease
                    
Install BridgingIT.DevKit.Common.Abstractions as a Cake Addin
#tool nuget:?package=BridgingIT.DevKit.Common.Abstractions&version=9.0.1-preview.0.97&prerelease
                    
Install BridgingIT.DevKit.Common.Abstractions 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. 
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.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.

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.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.0.1-preview.0.220 0 10 hours ago
9.0.1-preview.0.219 0 10 hours ago
9.0.1-preview.0.218 0 11 hours ago
9.0.1-preview.0.217 0 11 hours ago
9.0.1-preview.0.215 41 16 hours ago
9.0.1-preview.0.214 24 16 hours ago
9.0.1-preview.0.213 40 17 hours ago
9.0.1-preview.0.212 52 18 hours ago
9.0.1-preview.0.211 24 18 hours ago
9.0.1-preview.0.210 34 a day ago
9.0.1-preview.0.209 46 2 days ago
9.0.1-preview.0.208 52 2 days ago
9.0.1-preview.0.206 37 2 days ago
9.0.1-preview.0.205 41 2 days ago
9.0.1-preview.0.204 37 2 days ago
9.0.1-preview.0.202 32 2 days ago
9.0.1-preview.0.199 45 4 days ago
9.0.1-preview.0.198 83 5 days ago
9.0.1-preview.0.196 81 5 days ago
9.0.1-preview.0.193 80 5 days ago
9.0.1-preview.0.189 108 7 days ago
9.0.1-preview.0.188 435 8 days ago
9.0.1-preview.0.187 450 8 days ago
9.0.1-preview.0.186 434 8 days ago
9.0.1-preview.0.185 434 8 days ago
9.0.1-preview.0.184 433 8 days ago
9.0.1-preview.0.183 431 9 days ago
9.0.1-preview.0.182 47 12 days ago
9.0.1-preview.0.180 97 12 days ago
9.0.1-preview.0.179 104 12 days ago
9.0.1-preview.0.178 102 12 days ago
9.0.1-preview.0.175 104 13 days ago
9.0.1-preview.0.174 103 14 days ago
9.0.1-preview.0.173 118 14 days ago
9.0.1-preview.0.172 157 14 days ago
9.0.1-preview.0.171 107 14 days ago
9.0.1-preview.0.170 106 14 days ago
9.0.1-preview.0.165 104 15 days ago
9.0.1-preview.0.162 109 16 days ago
9.0.1-preview.0.160 108 16 days ago
9.0.1-preview.0.152 88 19 days ago
9.0.1-preview.0.148 124 20 days ago
9.0.1-preview.0.147 111 20 days ago
9.0.1-preview.0.146 108 21 days ago
9.0.1-preview.0.145 115 21 days ago
9.0.1-preview.0.141 117 21 days ago
9.0.1-preview.0.140 155 23 days ago
9.0.1-preview.0.139 113 23 days ago
9.0.1-preview.0.138 126 23 days ago
9.0.1-preview.0.137 109 25 days ago
9.0.1-preview.0.135 122 25 days ago
9.0.1-preview.0.134 161 a month ago
9.0.1-preview.0.133 156 a month ago
9.0.1-preview.0.132 153 a month ago
9.0.1-preview.0.130 153 a month ago
9.0.1-preview.0.129 206 a month ago
9.0.1-preview.0.128 158 a month ago
9.0.1-preview.0.127 164 a month ago
9.0.1-preview.0.125 169 a month ago
9.0.1-preview.0.119 68 a month ago
9.0.1-preview.0.118 52 a month ago
9.0.1-preview.0.116 57 a month ago
9.0.1-preview.0.112 46 a month ago
9.0.1-preview.0.111 51 a month ago
9.0.1-preview.0.110 104 a month ago
9.0.1-preview.0.107 54 a month ago
9.0.1-preview.0.106 54 a month ago
9.0.1-preview.0.105 57 a month ago
9.0.1-preview.0.104 61 a month ago
9.0.1-preview.0.103 79 a month ago
9.0.1-preview.0.102 75 a month ago
9.0.1-preview.0.100 48 a month ago
9.0.1-preview.0.99 88 a month ago
9.0.1-preview.0.97 58 a month ago
9.0.1-preview.0.96 49 a month ago
9.0.1-preview.0.94 52 a month ago
9.0.1-preview.0.93 78 a month ago
9.0.1-preview.0.92 53 a month ago
9.0.1-preview.0.91 45 a month ago
9.0.1-preview.0.88 46 a month ago
9.0.1-preview.0.87 232 a month ago
9.0.1-preview.0.85 250 a month ago
9.0.1-preview.0.84 193 2 months ago
9.0.1-preview.0.82 152 2 months ago
9.0.1-preview.0.79 161 2 months ago
9.0.1-preview.0.78 179 2 months ago
9.0.1-preview.0.77 151 2 months ago
9.0.1-preview.0.76 195 2 months ago
9.0.1-preview.0.73 184 2 months ago
9.0.1-preview.0.71 125 2 months ago
9.0.1-preview.0.70 176 2 months ago
9.0.1-preview.0.69 164 2 months ago
9.0.1-preview.0.67 174 2 months ago
9.0.1-preview.0.62 157 2 months ago
9.0.1-preview.0.58 66 2 months ago
9.0.1-preview.0.56 54 2 months ago
9.0.1-preview.0.55 44 2 months ago
9.0.1-preview.0.54 46 2 months ago
9.0.1-preview.0.53 45 2 months ago
9.0.1-preview.0.52 47 2 months ago
9.0.1-preview.0.50 62 2 months ago
9.0.1-preview.0.49 83 2 months ago
9.0.1-preview.0.47 49 2 months ago
9.0.1-preview.0.45 52 2 months ago
9.0.1-preview.0.43 56 2 months ago
9.0.1-preview.0.42 51 2 months ago
9.0.1-preview.0.41 55 2 months ago
9.0.1-preview.0.35 53 2 months ago
9.0.1-preview.0.20 51 2 months ago
9.0.1-preview.0.19 47 2 months ago
9.0.1-preview.0.18 50 2 months ago
9.0.1-preview.0.14 50 2 months ago
9.0.1-preview.0.13 55 2 months ago
9.0.1-preview.0.11 44 2 months ago
9.0.1-preview.0.10 44 2 months ago
9.0.1-preview.0.9 49 2 months ago
9.0.1-preview.0.2 89 2 months ago
3.0.5-preview.0.2 0 10 hours ago
3.0.5-preview.0.1 69 2 months ago
3.0.4 438 2 months ago
3.0.4-preview.0.38 56 2 months ago
3.0.4-preview.0.37 94 4 months ago
3.0.4-preview.0.36 188 4 months ago
3.0.4-preview.0.34 60 4 months ago
3.0.4-preview.0.32 61 4 months ago
3.0.4-preview.0.31 79 4 months ago
3.0.4-preview.0.30 57 4 months ago
3.0.4-preview.0.29 49 4 months ago
3.0.4-preview.0.28 110 4 months ago
3.0.4-preview.0.27 50 4 months ago
3.0.4-preview.0.23 52 4 months ago
3.0.4-preview.0.21 46 4 months ago
3.0.4-preview.0.20 50 4 months ago
3.0.4-preview.0.19 61 4 months ago
3.0.4-preview.0.18 47 4 months ago
3.0.4-preview.0.17 50 4 months ago
3.0.4-preview.0.16 51 5 months ago
3.0.4-preview.0.15 51 5 months ago
3.0.4-preview.0.14 67 5 months ago
3.0.4-preview.0.13 60 5 months ago
3.0.4-preview.0.12 56 5 months ago
3.0.4-preview.0.8 61 5 months ago
3.0.4-preview.0.7 59 5 months ago
3.0.4-preview.0.6 51 5 months ago
3.0.4-preview.0.5 61 5 months ago
3.0.4-preview.0.4 50 5 months ago
3.0.4-preview.0.3 53 5 months ago
3.0.4-preview.0.2 57 5 months ago
3.0.4-preview.0.1 187 6 months ago
3.0.3 378 6 months ago
3.0.3-preview.0.56 68 6 months ago
3.0.3-preview.0.55 63 6 months ago
3.0.3-preview.0.54 65 6 months ago
3.0.3-preview.0.50 60 6 months ago
3.0.3-preview.0.49 78 6 months ago
3.0.3-preview.0.44 83 6 months ago
3.0.3-preview.0.43 58 6 months ago
3.0.3-preview.0.42 58 6 months ago
3.0.3-preview.0.41 61 6 months ago
3.0.3-preview.0.40 89 6 months ago
3.0.3-preview.0.39 63 6 months ago
3.0.3-preview.0.38 60 6 months ago
3.0.3-preview.0.36 65 6 months ago
3.0.3-preview.0.35 75 6 months ago
3.0.3-preview.0.34 71 6 months ago
3.0.3-preview.0.33 58 6 months ago
3.0.3-preview.0.32 88 6 months ago
3.0.3-preview.0.31 610 7 months ago
3.0.3-preview.0.30 58 7 months ago
3.0.3-preview.0.29 55 7 months ago
3.0.3-preview.0.28 47 7 months ago
3.0.3-preview.0.27 66 7 months ago
3.0.3-preview.0.26 67 7 months ago
3.0.3-preview.0.25 56 7 months ago
3.0.3-preview.0.24 66 7 months ago
3.0.3-preview.0.23 80 7 months ago
3.0.3-preview.0.22 47 8 months ago
3.0.3-preview.0.21 67 8 months ago
3.0.3-preview.0.18 70 9 months ago
3.0.3-preview.0.17 60 9 months ago
3.0.3-preview.0.16 50 9 months ago
3.0.3-preview.0.15 58 9 months ago
3.0.3-preview.0.14 122 9 months ago
3.0.3-preview.0.13 84 9 months ago
3.0.3-preview.0.12 75 9 months ago
3.0.3-preview.0.11 73 9 months ago
3.0.3-preview.0.9 356 5/27/2024
3.0.3-preview.0.8 70 5/27/2024
3.0.3-preview.0.7 96 5/17/2024
3.0.3-preview.0.6 71 5/14/2024
3.0.3-preview.0.5 241 5/8/2024
3.0.3-preview.0.3 95 5/6/2024
3.0.3-preview.0.1 78 4/25/2024
3.0.2 1,194 4/25/2024
3.0.2-preview.0.4 91 4/25/2024
3.0.2-preview.0.3 144 4/25/2024
3.0.2-preview.0.2 95 4/25/2024
3.0.2-preview.0.1 73 4/25/2024
3.0.1 429 4/25/2024
3.0.1-preview.0.10 77 4/24/2024
3.0.1-preview.0.9 182 4/19/2024
3.0.1-preview.0.8 66 4/24/2024
3.0.1-preview.0.7 131 4/24/2024

## Release 3.0.1 [25.04.24]

- [N] Initial release

-----

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