LanceC.DependencyGraph 1.0.1

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

// Install LanceC.DependencyGraph as a Cake Tool
#tool nuget:?package=LanceC.DependencyGraph&version=1.0.1                

DependencyGraph

This package is used to execute processes that are dependent on the execution of at least one other process. The engine builds a directed graph of provided executions, checks for cycles, performs a reverse topological sort, and executes the results in order.

Install

Install the NuGet package into your project.

PM> Install-Package LanceC.DependencyGraph
$ dotnet add package LanceC.DependencyGraph

Usage

  • The dependency graph classes must first be registered for DI.
  • Processes to be executed need to implement IDependencyExecution<T>.
    • The identifier type has to implement IEquatable<T>.
    • It is recommended to register each execution in the DI container and retrieve them as an IEnumerable<IDependencyExecution<T>>.

Registration

services.AddDependencyGraph();

Execution

The sample below uses string as the identifier type for the executions.

public class Foo
{
    private readonly IDependencyExecutionEngine<string> _dependencyExecutionEngine;
    private readonly IEnumerable<IDependencyExecution<string>> _executions;

    public Foo(
        IDependencyExecutionEngine<string> dependencyExecutionEngine,
        IEnumerable<IDependencyExecution<string>> executions)
    {
        _dependencyExecutionEngine = dependencyExecutionEngine;
        _executions = executions;
    }

    public async Task Execute(CancellationToken cancellationToken)
    {
        await _dependencyExecutionEngine.ExecuteAll(executions, cancellationToken);
    }
}

Errors

  • In the case where a circular dependency chain is found (e.g. A has a dependency on B and B has a dependency on A), a CircularDependenciesException is thrown upon engine execution.
  • In the case where multiple executions contain the same key, a DuplicateKeyException is thrown upon engine execution.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 525 5/28/2020
1.0.1 469 11/13/2019
1.0.0 463 11/10/2019

Initial release.

1.0.1 patch:
- Throw exception when execution collection contains duplicate keys.
- Support executions with return results.