Replies: 2 comments
-
Hi @bitcrusader ,thanks for your interest in the project. You have an interesting idea here. Let's consider this class class Test
{
[Notify]
public string Name {get; set;}
[Notify (DependsOn = nameof(Name) )]
public string FirstName {get; set;}
} In this case When you apply [Notify (DependsOn = nameof(Name) )]
class Test
{
[Notify]
public string Name {get; set;}
[Notify (DependsOn = nameof(Name) )]
public string FirstName {get; set;}
} you effectively doing this: class Test
{
[Notify]
[Notify (DependsOn = nameof(Name) )]
public string Name {get; set;}
[Notify (DependsOn = nameof(Name) )]
[Notify (DependsOn = nameof(Name) )]
public string FirstName {get; set;}
} but it still won't trigger Aspect on [Notify (DependsOn = nameof(Name) )]
public string Name {get; set;} To solve it you might need to keep track on the dependencies in the class, but figure this dependencies on the first hit. Like the following:
|
Beta Was this translation helpful? Give feedback.
-
If it already the case. And you just need to apply aspects to all properties, you might just want to have different attributes. Like this: [Notifiable]
class Test
{
[Notify]
public string Name {get; set;}
[Notify (DependsOn = nameof(Name) )]
public string FirstName {get; set;}
public string FirstName {get; set;}
} so like this Aspect will be executed for all props and then you can raise events only for those having |
Beta Was this translation helpful? Give feedback.
-
My goal is to give
NotifyAttribute
a parameter "dependsOn", which causes it to be notified any time some other property is changed - basically the reverse of AlsoNotify. To do this, my first instinct was to add something along the lines ofHowever, this Advise doesn't actually seem to be triggered unless the aspect is applied directly to the class or the constructor - is there any way to have this be run used when the attribute is applied to a property instead?
Beta Was this translation helpful? Give feedback.
All reactions