Encamina.Enmarcha.Entities.Abstractions 8.1.5

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Encamina.Enmarcha.Entities.Abstractions --version 8.1.5
NuGet\Install-Package Encamina.Enmarcha.Entities.Abstractions -Version 8.1.5
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" />
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
#r "nuget: Encamina.Enmarcha.Entities.Abstractions, 8.1.5"
#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

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

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

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

Package Downloads
Encamina.Enmarcha.AI.Abstractions

Package Description

Encamina.Enmarcha.AI.TextsTranslation.Abstractions

Package Description

Encamina.Enmarcha.AI.IntentsPrediction.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.1.6-preview-07 353 4/29/2024
8.1.6-preview-06 374 4/26/2024
8.1.6-preview-05 465 4/24/2024
8.1.6-preview-04 441 4/22/2024
8.1.6-preview-03 428 4/22/2024
8.1.6-preview-02 512 4/17/2024
8.1.6-preview-01 493 4/15/2024
8.1.5 586 4/15/2024
8.1.5-preview-15 399 4/10/2024
8.1.5-preview-14 392 3/20/2024
8.1.5-preview-13 314 3/18/2024
8.1.5-preview-12 358 3/13/2024
8.1.5-preview-11 315 3/13/2024
8.1.5-preview-10 332 3/13/2024
8.1.5-preview-09 364 3/12/2024
8.1.5-preview-08 324 3/12/2024
8.1.5-preview-07 331 3/8/2024
8.1.5-preview-06 642 3/8/2024
8.1.5-preview-05 320 3/7/2024
8.1.5-preview-04 354 3/7/2024
8.1.5-preview-03 339 3/7/2024
8.1.5-preview-02 439 2/28/2024
8.1.5-preview-01 477 2/19/2024
8.1.4 810 2/15/2024
8.1.3 602 2/13/2024
8.1.3-preview-07 357 2/13/2024
8.1.3-preview-06 332 2/12/2024
8.1.3-preview-05 334 2/9/2024
8.1.3-preview-04 312 2/8/2024
8.1.3-preview-03 330 2/7/2024
8.1.3-preview-02 414 2/2/2024
8.1.3-preview-01 436 2/2/2024
8.1.2 612 2/1/2024
8.1.2-preview-9 383 1/22/2024
8.1.2-preview-8 372 1/19/2024
8.1.2-preview-7 424 1/19/2024
8.1.2-preview-6 359 1/19/2024
8.1.2-preview-5 413 1/19/2024
8.1.2-preview-4 405 1/19/2024
8.1.2-preview-3 374 1/18/2024
8.1.2-preview-2 591 1/18/2024
8.1.2-preview-16 333 1/31/2024
8.1.2-preview-15 335 1/31/2024
8.1.2-preview-14 414 1/25/2024
8.1.2-preview-13 305 1/25/2024
8.1.2-preview-12 311 1/23/2024
8.1.2-preview-11 298 1/23/2024
8.1.2-preview-10 336 1/22/2024
8.1.2-preview-1 328 1/18/2024
8.1.1 586 1/18/2024
8.1.0 565 1/18/2024
8.0.3 675 12/29/2023
8.0.1 577 12/14/2023
8.0.0 736 12/7/2023
6.0.4.3 598 12/29/2023
6.0.4.2 601 12/20/2023
6.0.4.1 638 12/19/2023
6.0.4 711 12/4/2023
6.0.3.20 660 11/27/2023
6.0.3.19 657 11/22/2023