ChipDemo/Core/Features/Feature.cs

29 lines
583 B
C#
Raw Permalink Normal View History

2023-04-07 22:10:35 +08:00
using Demo.Models;
namespace Demo.Features;
/// <summary>
/// 抽象功能类
/// </summary>
2023-04-08 08:35:57 +08:00
public abstract class Feature
2023-04-07 22:10:35 +08:00
{
/// <summary>
/// 执行顺序
/// </summary>
public int Order { get; init; }
public bool Finished { get; protected set; }
public string Name { get; init; } = String.Empty;
2023-04-08 08:35:57 +08:00
public abstract void Execute(IMetadata metadata);
2023-04-07 22:10:35 +08:00
2023-04-08 08:35:57 +08:00
public virtual void OnException(FeatureExceptionContext context)
2023-04-07 22:10:35 +08:00
{
throw context.Exception;
}
2023-04-09 16:22:54 +08:00
2023-04-07 22:10:35 +08:00
}
2023-04-08 08:35:57 +08:00
public delegate void FeatureFunction(Feature feature, IMetadata metadata);