Skip to content

Instantly share code, notes, and snippets.

@flew2bits
Created November 6, 2024 11:48
Show Gist options
  • Save flew2bits/21dc9347523d596a1398e4195a075e28 to your computer and use it in GitHub Desktop.
Save flew2bits/21dc9347523d596a1398e4195a075e28 to your computer and use it in GitHub Desktop.
public record MyCommand([property: Identity] Guid Id, string SomeValue);
[AttributeUsage(AttributeTargets.Method)]
public class MyAttribute: Attribute {
public MyAttribute(string something) => Something = something;
public string Something {get;}
}
public static class MyCommandHandler {
[AggregateHandler]
[MyAttribute("Some Value")]
public static Events Handle(MyCommand cmd) {
// do work
return [];
}
}
public static class MyMiddleware {
public void Before(MyCommand command, MyAttribute attribute) {
// do something with the value in the attribute
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment