MC
Metalama CommunityAndreu
Does Metalama only support attributes?
I navigated in all Metalama documentation, but I want to override a method for all types that inherit from
BusinessException
.
I don't want to use attributes because for my use case it's more natural to extend from a class.Petr Onderka•312d ago
The easiest way to achieve that is to add the
[Inheritable]
attribute (documentation: https://doc.metalama.net/conceptual/aspects/aspect-inheritance) to the aspect. Here is an example: https://try.metalama.net/#N4IgZiBcDaoHZRABQE4HsDmKCGBbAdAMYDOIANCIYgK7ECWcGABALICmALtgDZ7b4AxHLjYB3NCgDW+AILEADm0IdiAbgA6cWg2bsuvXPyF4xE6QGE0AEzYa4m6AEk4ACzYo6XAEbc2AXU1CXmJiJgAZTBlubhkODg8vag42SCYAFQBPRTlFZU1gTSYipnlqHzpCJjQAN3cPGyZqtDorJgAhajpuKxylDgAKR17lDq6bFAAeRwA5EytMxQA+JkSx9wBKQuKCuGK9pjAJNmxCFyZ+6uwUJhEOF2smBhXO7vd8NKuMTnw9e6tiTa7fZFHbA4GrV4oWRWaoVNj4ADytRQ9TY-VufzITDgJjQYH6EQw63WdjBTAAvlsipT7ECitA0mxcPJeMkAnSmFYMjjcBUAPzhTD9QF7UFgyxwYhoXz4ADqHmSYQYaIAJOoQABRODJDyMG6cP5MYC3fgfFBfDg-A3Wcn4dUkzRU-YoTjUFC7E34VBoQhsNhWYWk4o0mkOQlRbjs7BeYjxE4cJhBbAhdraOBsEIagAevvkHDoaF2qWzufzhfyTqaLXaybY5mCxF+1mFRopmlDcCTKYlhBdyQ69HTmZzbDzBaLqcHGeIJdHZdpYqKVdaABF3HRalZ68nG9aA+tWyHyCBJIgOCByX5yUAAndreu•312d ago
Wow, incredibly helpful, thanks!
Gael Fraiteur•312d ago
There's also a video here: https://doc.metalama.net/videos/fabrics-and-inheritance
Want results from more Discord servers?
More PostsCan Metalama suppress compiler errors?Hello! I want to know if I can use Metalama in my library.
The users of my library have to declare Eligibility rule based on target method not returning voidTypically eligibility rules I've put together are based on a specifically typed return or paramters.Follow up question from yesterday's meetupNow that I've had time to review what was discussed I think I can now ask the question I'd wanted toPlease cache licensing key rather than check every buildEvery time I attempt to build an aspect today, I'm getting an error that I've got an invalid licenseDocumentation: Bad linkAt https://doc.metalama.net/conceptual/using/fabrics there's a link at the bottom titled "ConfigurinCan one pass state between aspects?One can trivially pass arbitrary data between the aspect class and a template via the 'args' parametOrdering AspectsIn the documentation it states:
'Aspects must be ordered using the AspectOrderAttribute assembly-levThis error has me foxedIt's our old friend LAMA0001
Can't work out where it is getting Net Framework reference from.
Pr