elsa-core/src/common/Elsa.Features/Abstractions/FeatureBase.cs

49 lines
1.2 KiB
C#
Raw Normal View History

using Elsa.Features.Services;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Features.Abstractions;
2022-08-26 19:59:17 +00:00
/// <summary>
/// Base type for classes that represent a feature.
/// </summary>
public abstract class FeatureBase : IFeature
{
2022-08-26 19:59:17 +00:00
/// <summary>
/// Constructor.
/// </summary>
protected FeatureBase(IModule module)
{
Module = module;
}
2022-08-26 19:59:17 +00:00
/// <summary>
/// The module this feature is a part of.
/// </summary>
public IModule Module { get; }
2022-08-26 19:59:17 +00:00
/// <summary>
/// A reference to the <see cref="IServiceCollection"/> to which services can be added.
/// </summary>
public IServiceCollection Services => Module.Services;
2022-08-26 19:59:17 +00:00
/// <summary>
/// Override this method to configure your feature.
/// </summary>
public virtual void Configure()
{
}
2022-08-26 19:59:17 +00:00
/// <summary>
/// Override this method to register any hosted services provided by your feature.
/// </summary>
public virtual void ConfigureHostedServices()
{
}
2022-08-26 19:59:17 +00:00
/// <summary>
/// Override this to register services with <see cref="Services"/>.
/// </summary>
public virtual void Apply()
{
}
}