Encamina.Enmarcha.Entities.Abstractions 8.1.6-preview-03

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.6-preview-03                
NuGet\Install-Package Encamina.Enmarcha.Entities.Abstractions -Version 8.1.6-preview-03                
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.6-preview-03" />                
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.6-preview-03                
#r "nuget: Encamina.Enmarcha.Entities.Abstractions, 8.1.6-preview-03"                
#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.6-preview-03&prerelease

// Install Encamina.Enmarcha.Entities.Abstractions as a Cake Tool
#tool nuget:?package=Encamina.Enmarcha.Entities.Abstractions&version=8.1.6-preview-03&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 1,165 10/22/2024
8.2.0-preview-01-m01 782 9/17/2024
8.1.9-preview-03 592 11/19/2024
8.1.9-preview-02 533 10/22/2024
8.1.9-preview-01 854 10/4/2024
8.1.8 1,416 9/23/2024
8.1.8-preview-07 1,239 9/12/2024
8.1.8-preview-06 954 9/11/2024
8.1.8-preview-05 761 9/10/2024
8.1.8-preview-04 1,135 8/16/2024
8.1.8-preview-03 828 8/13/2024
8.1.8-preview-02 715 8/13/2024
8.1.8-preview-01 728 8/12/2024
8.1.7 849 8/7/2024
8.1.7-preview-09 732 7/3/2024
8.1.7-preview-08 693 7/2/2024
8.1.7-preview-07 678 6/10/2024
8.1.7-preview-06 655 6/10/2024
8.1.7-preview-05 698 6/6/2024
8.1.7-preview-04 650 6/6/2024
8.1.7-preview-03 695 5/24/2024
8.1.7-preview-02 542 5/10/2024
8.1.7-preview-01 620 5/8/2024
8.1.6 2,074 5/7/2024
8.1.6-preview-08 649 5/2/2024
8.1.6-preview-07 694 4/29/2024
8.1.6-preview-06 1,276 4/26/2024
8.1.6-preview-05 727 4/24/2024
8.1.6-preview-04 704 4/22/2024
8.1.6-preview-03 671 4/22/2024
8.1.6-preview-02 791 4/17/2024
8.1.6-preview-01 791 4/15/2024
8.1.5 862 4/15/2024
8.1.5-preview-15 677 4/10/2024
8.1.5-preview-14 726 3/20/2024
8.1.5-preview-13 627 3/18/2024
8.1.5-preview-12 689 3/13/2024
8.1.5-preview-11 611 3/13/2024
8.1.5-preview-10 653 3/13/2024
8.1.5-preview-09 661 3/12/2024
8.1.5-preview-08 660 3/12/2024
8.1.5-preview-07 634 3/8/2024
8.1.5-preview-06 949 3/8/2024
8.1.5-preview-05 645 3/7/2024
8.1.5-preview-04 723 3/7/2024
8.1.5-preview-03 691 3/7/2024
8.1.5-preview-02 830 2/28/2024
8.1.5-preview-01 736 2/19/2024
8.1.4 1,111 2/15/2024
8.1.3 893 2/13/2024
8.1.3-preview-07 667 2/13/2024
8.1.3-preview-06 699 2/12/2024
8.1.3-preview-05 669 2/9/2024
8.1.3-preview-04 656 2/8/2024
8.1.3-preview-03 668 2/7/2024
8.1.3-preview-02 723 2/2/2024
8.1.3-preview-01 690 2/2/2024
8.1.2 892 2/1/2024
8.1.2-preview-9 660 1/22/2024
8.1.2-preview-8 637 1/19/2024
8.1.2-preview-7 677 1/19/2024
8.1.2-preview-6 660 1/19/2024
8.1.2-preview-5 671 1/19/2024
8.1.2-preview-4 642 1/19/2024
8.1.2-preview-3 641 1/18/2024
8.1.2-preview-2 855 1/18/2024
8.1.2-preview-16 620 1/31/2024
8.1.2-preview-15 636 1/31/2024
8.1.2-preview-14 785 1/25/2024
8.1.2-preview-13 668 1/25/2024
8.1.2-preview-12 683 1/23/2024
8.1.2-preview-11 655 1/23/2024
8.1.2-preview-10 599 1/22/2024
8.1.2-preview-1 626 1/18/2024
8.1.1 859 1/18/2024
8.1.0 828 1/18/2024
8.0.3 934 12/29/2023
8.0.1 834 12/14/2023
8.0.0 1,037 12/7/2023
6.0.4.3 876 12/29/2023
6.0.4.2 881 12/20/2023
6.0.4.1 946 12/19/2023
6.0.4 988 12/4/2023
6.0.3.20 935 11/27/2023
6.0.3.19 933 11/22/2023