Skip to content

Instantly share code, notes, and snippets.

@InvaderZim85
Last active November 22, 2019 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save InvaderZim85/c9cd9ac584724270e238419d07a0bfb4 to your computer and use it in GitHub Desktop.
Save InvaderZim85/c9cd9ac584724270e238419d07a0bfb4 to your computer and use it in GitHub Desktop.
Usage of the custom attribute in the meta module
public class InfoMetadataModule : MetadataModule<CustomMetadata>
{
public InfoMetadataModule()
{
var metaData = GetCustomMetadata();
foreach (var entry in metaData)
{
Describe[entry.Name] = x => new CustomMetadata(x, entry.Description);
}
}
private List<RouteDescriptionAttribute> GetCustomMetadata()
{
return (from constructor in typeof(InfoModule).GetConstructors()
from attribute in constructor.GetCustomAttributes<RouteDescriptionAttribute>()
select attribute).ToList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment