Skip to content

Getting Target Property Custom Attributes during OverridePropertySetter? #23

Answered by gfraiteur
bradlee-s asked this question in Q&A
Discussion options

You must be logged in to vote

To reflect attributes, you can use the Attributes collection on meta.Target.Property.

To add an attribute:

  1. Make sure you have the latest build of Metalama - this is a new feature.
  2. Override BuildAspect.
  3. Call builder.Advice.AddAttribute. However the attribute added in BuildAspect will not be visible in your template method (for the sake of consistency and ease of programming, we consistently expose, to any aspect A, the code model in the state before that aspect A was applied.

You may consider passing a parameter from BuildAspect to your template.

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
5 replies
@bradlee-s
Comment options

@prochan2
Comment options

@bradlee-s
Comment options

@addabis
Comment options

@bradlee-s
Comment options

Answer selected by gfraiteur
Comment options

You must be logged in to vote
3 replies
@aweneer
Comment options

@bradlee-s
Comment options

@gfraiteur
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants