public static string Moniker(this OfficialPlugin plugin) { var info = typeof(OfficialPlugin).GetField(plugin.ToString()); var da = info.GetCustomAttribute <MonikerAttribute>(); if (da == null) { throw new InvalidOperationException($"{plugin} plugin must have a {nameof(MonikerAttribute)}"); } return(da.Moniker); }
public ElasticsearchPlugin(OfficialPlugin plugin, Func <ElasticsearchVersion, bool> validForVersion = null) { this._plugin = plugin; this._validForVersion = validForVersion; this.Moniker = plugin.Moniker(); }