Skip to content

Proper usage of AutoNotifyPropertyChangedInterceptor #49

@sekulicb

Description

@sekulicb

Hi. How do we set up the binding for AutoNotifyPropertyChangedInterceptor in a custom module? What I have tried so far:

public class MyViewModel : IMyViewModel {
virtual properties and methods marked with [NotifyOfChanges] attribute
public void OnPropertyChanged
}

public IMyViewModel : IAutoPropertyChanged {
}

*My custom module

public class MyModule : NinjectModule {

Bind(typeof(AutoNotifyPropertyChangedInterceptor<>)).ToSelf() - not working
Bind(typeof(IAutoNotifyPropertyChangedIntercertor<>).To(typeof(AutoNotifyPropertyChangedInterceptor<>)(); - not working
.
.
ViewModel binding works without problems

also, what is correct intercept binding method on the ViewModel itself?

binding.Intercept().With<AutoNotifyPropertyChangedInterceptor>().InOrder(1);
...some other interceptor in chain

or

binding.Intercept().With<IAutoNotifyPropertyChangedInterceptor>
.InOrder(1);
...some other interceptor in chain

I have tried both approaches (binding to interface and concrete type) but it throws an exception during kernel build. Should I use InterceptAttribute for this interceptor instead of binding in a module ?

Any help would be appreciated. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions