Tildom.Core 6.0.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Tildom.Core --version 6.0.2                
NuGet\Install-Package Tildom.Core -Version 6.0.2                
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="Tildom.Core" Version="6.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tildom.Core --version 6.0.2                
#r "nuget: Tildom.Core, 6.0.2"                
#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.
// Install Tildom.Core as a Cake Addin
#addin nuget:?package=Tildom.Core&version=6.0.2

// Install Tildom.Core as a Cake Tool
#tool nuget:?package=Tildom.Core&version=6.0.2                

Welcome to Tildom.Core

Introduction

Tildom.Core is a C# library offering the core types and methods for other Tildom libraries. Currently it has the definition and implementation of IOperationResult<T>. IOperationResutl<T> is designed to streamline handling operation results in .NET 6.0+ applications. It provides a robust way to encapsulate success, failure, and optional values, ensuring clear and consistent handling of various operation outcomes.

An Important Note on Versioning

Tildom.Core and most other Tildom domain libraries are versioned following their minimum-supported .NET version as the primary version number. In the case of 6.0.0, this means the library supports .NET 6 and onwards. It is always a LTS version of the .NET, such as 6, 8 and so on. The secondary version number is the major version of the library itself (feature flag). The third version number is the minor version of the library itself (fix flag).

If you are using these libraries, you can easily tell which version to use based on the .NET version you are targeting. For example, if you are using .NET 6, you should use Tildom.Core 6.0.0. If you are on Tildom.Core 6.1.20 and 6.2.1 is available, you should be careful with updating since breaking changes could have been introduced.

When Is A .NET Version Deprecated

A shorter cycle is applied to this process compared to Microsoft's LTS support schedule. Libraries are hopefully updated to a new .NET version when a STS version is released. For instance, currently .NET 8.0 has just been released, in which case, the libraries would support the previous LTS version = .NET 6.0. When .NET 9.0 is released in 2024, the libraries would be updated to support .NET 8.0. But when in 2025, another LTS version is released, the libraries would still support .NET 8.0.

Features

  • Generic Operation Results: Handle success and failure scenarios generically using SuccessResult<T> and ErrorResult<T>.
  • Optional Values: Utilize Maybe<T> and LazyMaybe<T> for scenarios where values may or may not be present.
  • Asynchronous Support: Includes async-compatible methods with comprehensive support for cancellation tokens.
  • Extensive Logging: Integrated logging capabilities to track and audit operation outcomes.

Installation

To install the OperationResults library, use the following NuGet command:

Install-Package Tildom.Core

Or .NET CLI

dotnet add package OperationResults

Usage

Basic Usage

Here's a quick example of how to use SuccessResult<T>:

var success = new SuccessResult<int>(42);
success.Match(
    onSuccess: value => Console.WriteLine($"Success with value: {value}"),
    onError: (ex, maybe) => Console.WriteLine("An error occurred.")
);

Handling Errors

Example using ErrorResult<T>:

var errorResult = new ErrorResult<string>(new Exception("Error occurred"));
errorResult.Match(
    onSuccess: value => Console.WriteLine($"Unexpected success: {value}"),
    onError: (ex, maybe) => Console.WriteLine($"Error: {ex.Message}. ")
);

Contributing

We welcome contributions! If you would like to help improve the library, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Write your code and add tests.
  4. Submit a pull request with a clear description of your changes.

Please read our Contributing Guidelines for more information.

License

This library is licensed under the MIT License. See the LICENSE file for details.

Support

If you have any questions or need help, please open an issue in the GitHub repository.

Acknowledgements

Special thanks to all the contributors who have participated in this project.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Tildom.Core:

Package Downloads
Tildom.Utilities

Tildom.Utilities is a library that offers utility types and methods for .NET and C#.

Tildom.Libraries.MongoDb

Tildom.Libraries.MongoDb offers an abstraction layer on top of the official MongoDb Driver.

Tildom.Services

Tildom.Services is a C# library offering some convenient service and wrapper types.

Tildom.Libraries.Invenias

Tildom.Libraries.Invenias is a C#/Dotnet developer's library for Invenias's web APIs.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.1 142 11/22/2024
8.0.0 141 9/22/2024
6.0.3 391 2/1/2024
6.0.2 106 2/1/2024
6.0.0 394 11/20/2023