Ragent.Des 0.1.4

dotnet add package Ragent.Des --version 0.1.4
                    
NuGet\Install-Package Ragent.Des -Version 0.1.4
                    
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="Ragent.Des" Version="0.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ragent.Des" Version="0.1.4" />
                    
Directory.Packages.props
<PackageReference Include="Ragent.Des" />
                    
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 Ragent.Des --version 0.1.4
                    
#r "nuget: Ragent.Des, 0.1.4"
                    
#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 Ragent.Des@0.1.4
                    
#: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=Ragent.Des&version=0.1.4
                    
Install as a Cake Addin
#tool nuget:?package=Ragent.Des&version=0.1.4
                    
Install as a Cake Tool

Ragent.Des

Dependency Injection, Events, Services

<p align="center"> <img width="150" height="150" src="https://user-images.githubusercontent.com/100949170/217240165-b57d4784-62d6-4cbb-89f5-9b5797abf086.png"> </p>

Use Des Builder to create Des Manager

public class ExampleForReadme
{
    private IDesManager _manager;

    public void CreateDesBuilder()
    {
        _manager = new DesBuilder()
            .AddService<Service>()
            .Build();
    }
}

public class Service { }

Types can also be initialized with any of the following.

.AddService<Service>()
.AddService<Service>(new Service(args))
.AddService<Interface, Service>()

Fetching Services

public class ExampleForReadme
{
    private IDesManager _manager;

    public void CreateDesBuilder()
    {
        _manager = new DesBuilder()
            .AddService<Service>()
            .Build();
    }

    public void GetCountFromService()
    {
        var service = _manager.GetService<Service>();
        var count = service.GetCount();
    }
}

public class Service
{
    private int count = 0;

    public int GetCount()
    {
        return count;
    }
}

Registering Events

public class ExampleForReadme
{
    private IDesManager _manager;

    public void CreateDesBuilder()
    {
        _manager = new DesBuilder()
            .AddService<Service>()
            .Build();
        
        _manager.RegisterEvent<Service, Event>(GetCountFromService);
    }

    private void GetCountFromService(Event ev)
    {
        Console.WriteLine($"{ev.Amount} | {ev.NewCount}");
    }
}

public struct Event
{
    public int Amount { get; set; }
    public int NewCount { get; set; }
}

public class Service
{
    private event Action<Event>? ScoreAdded;
    private int count = 0;

    public void Add(int amount)
    {
        count += amount;
        ScoreAdded?.Invoke(new Event
        {
            Amount = amount,
            NewCount = count
        });
    }
}
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.  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. 
.NET Framework net472 is compatible.  net48 was computed.  net481 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
0.1.4 427 2/8/2023
0.1.3 380 2/7/2023
0.1.2 367 2/6/2023
0.1.1 395 2/5/2023
0.1.0 401 2/2/2023