Encamina.Enmarcha.Entities.Abstractions 8.1.5-preview-12

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

// Install Encamina.Enmarcha.Entities.Abstractions as a Cake Tool
#tool nuget:?package=Encamina.Enmarcha.Entities.Abstractions&version=8.1.5-preview-12&prerelease                

Entities - Abstractions

Nuget package

Entities Abstractions is a project that primarily contains abstractions used by other NuGet packages in ENMARCHA. These abstractions represent properties or characteristics that entities can have.

Setup

Nuget package

First, install NuGet. Then, install Encamina.Enmarcha.Entities.Abstractions from the package manager console:

PM> Install-Package Encamina.Enmarcha.Entities.Abstractions

.NET CLI:

Install .NET CLI. Next, install Encamina.Enmarcha.Entities.Abstractions from the .NET CLI:

dotnet add package Encamina.Enmarcha.Entities.Abstractions

How to use

HandlerManagerBase

HandlerManagerBase is a base class for a handlers manager. It serves as a foundation for handling various types of handlers. You can use it as a starting point for creating specialized handler manager classes.

public class CustomHandler
{
}

public class MyCustomHandlerManager : HandlerManagerBase<CustomHandler>
{
    public MyCustomHandlerManager(IEnumerable<CustomHandler> handlers) : base(handlers)
    {
    }

    public void LoopHandlers()
    {
        foreach (var handler in Handlers)
        {
            // ...
        }
    }
}

In the previous code, a class is created based on HandlerManagerBase where all the Handlers are looped in the LoopHandlers method.

HandlerProcessTimes

HandlerProcessTimes is an Enum that represents the process time when a specific handler should be executed. It has 4 possible values:

  • None: Indicates the handled should never be processed.
  • Begin: Indicates the handler should be processed at the beginning of the turn context.
  • End: Indicates the handler should be processed at the ending of the turn context.
  • Both: Indicates the handler should be processed at both, the beginning and the ending of the turn context.

IIdentifiable/IdentifiableBase

  • IIdentifiable is an interface that represents a uniquely identifiable entity.
  • IIdentifiable<T> is an interface that represents a uniquely identifiable entity.
  • IdentifiableBase is a base class for entities that must have a property that represents a unique identifier. It implements IIdentifiable.
  • IdentifiableBase<T> is a base class for entities that must have a property that represents a unique identifier. It implements IIdentifiable<T>.
public class MyCustomIdentifiableEntity : IIdentifiable
{
    public object Id { get; }
}

public class MyCustomTypedIdentifiableEntity : IIdentifiable<string>
{
    object IIdentifiable.Id => Id;

    public string Id { get; }
}

public class MyCustomIdentifiableBaseEntity : IdentifiableBase
{

}

public class MyCustomTypedIdentifiableBaseEntity : IdentifiableBase<string>
{

}

IIdentifiableValuable

IIdentifiableValuable is an interface that represents entities with an unique identifier and value. It implements IIdentifiable<T> and IValuable<T>.

public class MyCustomIdentifiableAndValuableEntity : IIdentifiableValuable<Guid, string>
{    
    public string Value { get; }

    object IIdentifiable.Id => Id;

    public Guid Id { get; }
}

IIntendable

IIntendable is an interface that represents an intendable entity. In other words, and entity that has an intent.

public class MyCustomIntendableEntity : IIntendable
{
    public string Intent { get; }
}

INameable

INameable is an interface that represents a nameable entity.

public class MyCustomNameableEntity : INameable
{
    public string Name { get; }
}

INameableIdentifiable

INameableIdentifiable is an interface that represents entities with a name and an unique identifier. It implements INameable and IIdentifiable<T>.

public class MyCustomNameableAndIdentifiableEntity : INameableIdentifiable<Guid>
{
    public string Name { get; }

    object IIdentifiable.Id => Id;

    public Guid Id { get; }
}

INameableIdentifiableValuable

INameableIdentifiableValuable is an interface that represents entities with a name, an unique identifier and value. It implements INameable, IIdentifiable<T> and IValuable<T>.

public class MyCustomNameableAndIdentifiableAndValuableEntity : INameableIdentifiableValuable<Guid, int>
{
    public string Name { get; }

    object IIdentifiable.Id => Id;

    public Guid Id { get; }

    public int Value { get; }
}

INameableValuable

INameableValuable is an interface that represents entities with a name and value. It implements INameable and IValuable<T>. This is an alternative to KeyValuePair and KeyValuePair{TKey, TValue}. The latter two do not support inheritance because KeyValuePair is a static class and KeyValuePair{TKey, TValue} is a structure.

public class MyCustomNameableAndValuableEntity : INameableValuable<int>
{
    public string Name { get; }

    public int Value { get; }
}

IOrderable

IOrderable is an interface that represents an orderable type.

public class MyCustomOrderableEntity : IOrderable
{    
    public int Order { get; }
}

IRetryHelper

IRetryHelper is an interface that represents a helper for retrying failed operations.

public class MyCustomRetryHelper : IRetryHelper
{
    public Task RetryOperationAsync(int retryTimes, int waitTimeMilliseconds, Func<Task> operation)
    {
        // ...
        // Implementation of retry operation
        // ...

        return Task.CompletedTask;
    }
}

There is an implementation of this interface in the NuGet package Encamina.Enmarcha.Entities, SimpleRetryHelper.

IServiceFactory/IServiceFactoryProvider

  • IServiceFactory<T> is an interface that represents a factory that can provide valid instances of a specific service of type T within a scope. There is an implementation of this interface in the NuGet package Encamina.Enmarcha.Entities, ServiceFactory<T>.
  • IServiceFactoryProvider<T> is an interface that represents a provider for factories of services of type T. There is an implementation of this interface in the NuGet package Encamina.Enmarcha.Entities, ServiceFactoryProvider<T>.

IValidableEntity/ValidableEntity

  • IValidableEntity is an interface that represents entities that provides their own validation mechanism.
  • ValidableEntity is a base class that represents an entity that can be validated by itself. It implements IValidableEntity.
public class MyCustomValidableEntity : ValidableEntity
{
    public string SomeProperty { get; set; }
    
    public override IEnumerable<string> Validate()
    {
        var validationResults = base.Validate().ToList();

        if (string.IsNullOrWhiteSpace(SomeProperty))
        {
            validationResults.Add("SomeProperty must not be empty.");
        }

        return validationResults;
    }
}

IValuable

IValuable is an interface that represents an entity with value.

public class MyCustomValuableEntity : IValuable<double>
{    
    public double Value { get; }
}

NameableHandlerManagerBase

NameableHandlerManagerBase is a base class for a handlers manager that uses handlers that implements the INameable interface.

public class CustomNameableHandler : INameable
{
    public CustomNameableHandler(string name)
    {
        Name = name;
    }

    public string Name { get; }
}

public class MyCustomHandlerManager : NameableHandlerManagerBase<CustomNameableHandler>
{
    public MyCustomHandlerManager(IEnumerable<CustomNameableHandler> handlers) : base(handlers)
    {
    }

    public void LoopHandlers()
    {
        foreach (var handler in Handlers)
        {
            Console.WriteLine($"{handler.Value}");
        }
    }
}

In the code above, a class is created based on NameableHandlerManagerBase where all the Handlers are looped in the LoopHandlers method.

OrderableHandlerManagerBase

OrderableHandlerManagerBase is a base class for a handlers manager that uses handlers that implements the IOrderable interface.

public class CustomOrderableHandler : IOrderable
{
    public CustomOrderableHandler(int order)
    {
        Order = order;
    }

    public int Order{ get; }
}

public class MyCustomHandlerManager : OrderableHandlerManagerBase<CustomOrderableHandler>
{
    public MyCustomHandlerManager(IEnumerable<CustomOrderableHandler> handlers) : base(handlers)
    {
    }

    public void LoopHandlers()
    {
        foreach (var handler in Handlers)
        {
            Console.WriteLine($"{handler.Order}");
        }
    }
}

In the code above, a class is created based on OrderableHandlerManagerBase where all the Handlers are looped in order by the LoopHandlers method.

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 (13)

Showing the top 5 NuGet packages that depend on Encamina.Enmarcha.Entities.Abstractions:

Package Downloads
Encamina.Enmarcha.AI.Abstractions

Package Description

Encamina.Enmarcha.AI.IntentsPrediction.Abstractions

Package Description

Encamina.Enmarcha.AI.TextsTranslation.Abstractions

Package Description

Encamina.Enmarcha.AI.LanguagesDetection.Abstractions

Package Description

Encamina.Enmarcha.Entities

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.2.0 930 10/22/2024
8.2.0-preview-01-m01 742 9/17/2024
8.1.9-preview-02 532 10/22/2024
8.1.9-preview-01 843 10/4/2024
8.1.8 1,303 9/23/2024
8.1.8-preview-07 1,141 9/12/2024
8.1.8-preview-06 953 9/11/2024
8.1.8-preview-05 760 9/10/2024
8.1.8-preview-04 1,134 8/16/2024
8.1.8-preview-03 827 8/13/2024
8.1.8-preview-02 714 8/13/2024
8.1.8-preview-01 727 8/12/2024
8.1.7 844 8/7/2024
8.1.7-preview-09 731 7/3/2024
8.1.7-preview-08 692 7/2/2024
8.1.7-preview-07 677 6/10/2024
8.1.7-preview-06 654 6/10/2024
8.1.7-preview-05 697 6/6/2024
8.1.7-preview-04 649 6/6/2024
8.1.7-preview-03 694 5/24/2024
8.1.7-preview-02 541 5/10/2024
8.1.7-preview-01 619 5/8/2024
8.1.6 1,946 5/7/2024
8.1.6-preview-08 648 5/2/2024
8.1.6-preview-07 693 4/29/2024
8.1.6-preview-06 1,267 4/26/2024
8.1.6-preview-05 726 4/24/2024
8.1.6-preview-04 703 4/22/2024
8.1.6-preview-03 670 4/22/2024
8.1.6-preview-02 788 4/17/2024
8.1.6-preview-01 790 4/15/2024
8.1.5 859 4/15/2024
8.1.5-preview-15 674 4/10/2024
8.1.5-preview-14 723 3/20/2024
8.1.5-preview-13 626 3/18/2024
8.1.5-preview-12 686 3/13/2024
8.1.5-preview-11 610 3/13/2024
8.1.5-preview-10 652 3/13/2024
8.1.5-preview-09 660 3/12/2024
8.1.5-preview-08 659 3/12/2024
8.1.5-preview-07 633 3/8/2024
8.1.5-preview-06 948 3/8/2024
8.1.5-preview-05 644 3/7/2024
8.1.5-preview-04 722 3/7/2024
8.1.5-preview-03 688 3/7/2024
8.1.5-preview-02 829 2/28/2024
8.1.5-preview-01 735 2/19/2024
8.1.4 1,108 2/15/2024
8.1.3 888 2/13/2024
8.1.3-preview-07 666 2/13/2024
8.1.3-preview-06 698 2/12/2024
8.1.3-preview-05 668 2/9/2024
8.1.3-preview-04 655 2/8/2024
8.1.3-preview-03 667 2/7/2024
8.1.3-preview-02 720 2/2/2024
8.1.3-preview-01 689 2/2/2024
8.1.2 889 2/1/2024
8.1.2-preview-9 659 1/22/2024
8.1.2-preview-8 636 1/19/2024
8.1.2-preview-7 676 1/19/2024
8.1.2-preview-6 657 1/19/2024
8.1.2-preview-5 670 1/19/2024
8.1.2-preview-4 641 1/19/2024
8.1.2-preview-3 640 1/18/2024
8.1.2-preview-2 854 1/18/2024
8.1.2-preview-16 619 1/31/2024
8.1.2-preview-15 635 1/31/2024
8.1.2-preview-14 780 1/25/2024
8.1.2-preview-13 667 1/25/2024
8.1.2-preview-12 680 1/23/2024
8.1.2-preview-11 654 1/23/2024
8.1.2-preview-10 598 1/22/2024
8.1.2-preview-1 625 1/18/2024
8.1.1 856 1/18/2024
8.1.0 825 1/18/2024
8.0.3 931 12/29/2023
8.0.1 831 12/14/2023
8.0.0 1,032 12/7/2023
6.0.4.3 871 12/29/2023
6.0.4.2 876 12/20/2023
6.0.4.1 939 12/19/2023
6.0.4 985 12/4/2023
6.0.3.20 932 11/27/2023
6.0.3.19 930 11/22/2023