Encamina.Enmarcha.Entities.Abstractions 8.2.0

dotnet add package Encamina.Enmarcha.Entities.Abstractions --version 8.2.0                
NuGet\Install-Package Encamina.Enmarcha.Entities.Abstractions -Version 8.2.0                
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.2.0" />                
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.2.0                
#r "nuget: Encamina.Enmarcha.Entities.Abstractions, 8.2.0"                
#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.2.0

// Install Encamina.Enmarcha.Entities.Abstractions as a Cake Tool
#tool nuget:?package=Encamina.Enmarcha.Entities.Abstractions&version=8.2.0                

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 1,542 10/22/2024
8.2.0-preview-01-m01 786 9/17/2024
8.1.9-preview-03 600 11/19/2024
8.1.9-preview-02 537 10/22/2024
8.1.9-preview-01 862 10/4/2024
8.1.8 1,570 9/23/2024
8.1.8-preview-07 1,391 9/12/2024
8.1.8-preview-06 958 9/11/2024
8.1.8-preview-05 768 9/10/2024
8.1.8-preview-04 1,145 8/16/2024
8.1.8-preview-03 836 8/13/2024
8.1.8-preview-02 719 8/13/2024
8.1.8-preview-01 734 8/12/2024
8.1.7 860 8/7/2024
8.1.7-preview-09 736 7/3/2024
8.1.7-preview-08 699 7/2/2024
8.1.7-preview-07 686 6/10/2024
8.1.7-preview-06 659 6/10/2024
8.1.7-preview-05 704 6/6/2024
8.1.7-preview-04 654 6/6/2024
8.1.7-preview-03 699 5/24/2024
8.1.7-preview-02 548 5/10/2024
8.1.7-preview-01 626 5/8/2024
8.1.6 2,218 5/7/2024
8.1.6-preview-08 653 5/2/2024
8.1.6-preview-07 698 4/29/2024
8.1.6-preview-06 1,280 4/26/2024
8.1.6-preview-05 731 4/24/2024
8.1.6-preview-04 708 4/22/2024
8.1.6-preview-03 675 4/22/2024
8.1.6-preview-02 801 4/17/2024
8.1.6-preview-01 799 4/15/2024
8.1.5 866 4/15/2024
8.1.5-preview-15 681 4/10/2024
8.1.5-preview-14 732 3/20/2024
8.1.5-preview-13 631 3/18/2024
8.1.5-preview-12 695 3/13/2024
8.1.5-preview-11 617 3/13/2024
8.1.5-preview-10 657 3/13/2024
8.1.5-preview-09 667 3/12/2024
8.1.5-preview-08 664 3/12/2024
8.1.5-preview-07 640 3/8/2024
8.1.5-preview-06 957 3/8/2024
8.1.5-preview-05 649 3/7/2024
8.1.5-preview-04 727 3/7/2024
8.1.5-preview-03 695 3/7/2024
8.1.5-preview-02 836 2/28/2024
8.1.5-preview-01 740 2/19/2024
8.1.4 1,119 2/15/2024
8.1.3 903 2/13/2024
8.1.3-preview-07 671 2/13/2024
8.1.3-preview-06 703 2/12/2024
8.1.3-preview-05 677 2/9/2024
8.1.3-preview-04 664 2/8/2024
8.1.3-preview-03 672 2/7/2024
8.1.3-preview-02 727 2/2/2024
8.1.3-preview-01 694 2/2/2024
8.1.2 896 2/1/2024
8.1.2-preview-9 664 1/22/2024
8.1.2-preview-8 641 1/19/2024
8.1.2-preview-7 681 1/19/2024
8.1.2-preview-6 666 1/19/2024
8.1.2-preview-5 675 1/19/2024
8.1.2-preview-4 646 1/19/2024
8.1.2-preview-3 645 1/18/2024
8.1.2-preview-2 859 1/18/2024
8.1.2-preview-16 624 1/31/2024
8.1.2-preview-15 640 1/31/2024
8.1.2-preview-14 791 1/25/2024
8.1.2-preview-13 672 1/25/2024
8.1.2-preview-12 687 1/23/2024
8.1.2-preview-11 659 1/23/2024
8.1.2-preview-10 603 1/22/2024
8.1.2-preview-1 630 1/18/2024
8.1.1 863 1/18/2024
8.1.0 832 1/18/2024
8.0.3 938 12/29/2023
8.0.1 838 12/14/2023
8.0.0 1,041 12/7/2023
6.0.4.3 880 12/29/2023
6.0.4.2 887 12/20/2023
6.0.4.1 952 12/19/2023
6.0.4 992 12/4/2023
6.0.3.20 939 11/27/2023
6.0.3.19 939 11/22/2023