Add project files.

This commit is contained in:
2025-08-18 17:11:43 +03:30
parent 807dc263be
commit e5eb10d604
3943 changed files with 223719 additions and 0 deletions
@@ -0,0 +1,60 @@
using Elsa.Features.Services;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Elsa.Features.Abstractions;
/// <summary>
/// Base type for classes that represent a feature.
/// </summary>
public abstract class FeatureBase : IFeature
{
/// <summary>
/// Constructor.
/// </summary>
protected FeatureBase(IModule module)
{
Module = module;
}
/// <summary>
/// The module this feature is a part of.
/// </summary>
public IModule Module { get; }
/// <summary>
/// A reference to the <see cref="IServiceCollection"/> to which services can be added.
/// </summary>
public IServiceCollection Services => Module.Services;
/// <summary>
/// Override this method to configure your feature.
/// </summary>
public virtual void Configure()
{
}
/// <summary>
/// Override this method to register any hosted services provided by your feature.
/// </summary>
public virtual void ConfigureHostedServices()
{
}
/// <summary>
/// Override this to register services with <see cref="Services"/>.
/// </summary>
public virtual void Apply()
{
}
/// <summary>
/// Configures the specified hosted service using an optional priority to control in which order it will be registered with the service container.
/// </summary>
/// <param name="priority">The priority.</param>
/// <typeparam name="T">The type of hosted service to configure.</typeparam>
protected void ConfigureHostedService<T>(int priority = 0) where T : class, IHostedService
{
Module.ConfigureHostedService<T>(priority);
}
}