【问题标题】:Postsharp Recordable and NotifyPropertyChangedPostsharp Recordable 和 NotifyPropertyChanged
【发布时间】:2018-04-09 17:04:43
【问题描述】:

我将“标准”NotifyPropertyChanged 方面与 Recordable 结合使用,效果很好。

现在我想检查我的自定义脏逻辑的更改。 为此,我编写了一个使用

的自定义方面
[OnLocationSetValueAdvice, MulticastPointcut(Targets = MulticastTargets.Property)]
public void OnPropertySet(LocationInterceptionArgs args)

手动更改属性时会调用此方法,但执行撤消时不会调用此方法,这对我来说似乎很奇怪。

我如何也能捕获来自撤消的更改?

【问题讨论】:

    标签: postsharp


    【解决方案1】:

    PostSharp 的[Recordable] 记录在字段级别而不是属性级别上发生变化,因此在撤消/重做期间会跳过您的方面。您应该将其应用于字段并在 Recordable 之后对其进行排序。

    或者,您可以实现callback interface

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多