using System;
using System.Collections.Generic;
namespace Apewer
{
/// 声明当前控制器类型可被 ApiEntries 获取。
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public sealed class ApiAttribute : Attribute
{
string _name, _caption, _description;
/// 在枚举 Application 列表时,显示的名称。
public string Name { get { return _name; } }
/// 在枚举 Application 列表时,显示的标题。
public string Caption { get { return _caption; } }
/// 在枚举 Application 列表时,显示的说明。
public string Description { get { return _description; } }
/// 创建 API 特性。
public ApiAttribute(string name = null, string caption = null, string description = null)
{
_name = string.IsNullOrEmpty(name) ? null : name.Trim();
_caption = string.IsNullOrEmpty(caption) ? null : caption.Trim();
_description = string.IsNullOrEmpty(description) ? null : description.Trim();
}
/// 从 到 Boolean 的隐式转换,判断 有效。
public static implicit operator bool(ApiAttribute instance) => instance != null;
}
}