My favorites | Sign in
Project Logo
                
Links:
Feeds:
People details
Project owners:
  andhallberg

EasyProp helps you replace repetetive code like:

public class Foo : INotifyPropertyChanged
{
    public string Bar 
    { 
       get{ return _bar; }
       set
       {
           if (_bar != value)
           {
              _bar = value;
              OnNotifyPropertyChanged(new PropertyChangedEventArgs("Bar"));
           }
       }
    }

    ...repeat for every property
}

... with:

[BeforePropertySetFilter(typeof(DoNothingIfValueNotChanged))]
[AfterPropertySetFilter(typeof(NotifyPropertyChanged))]
public class Foo : INotifyPropertyChanged
{
    public virtual string Bar { get; set; }
    ...
}

There are other filters available, and you can write your own:

[BeforePropertySetFilter(typeof(DoNothingIfValueNotChanged))]
[AfterPropertySetFilter(typeof(MarkObjectAsDirty))]
public class Foo
{
    public virtual bool IsDirty { get; set; }
    public virtual string Bar { get; set; }
}

Just mark your properties as virtual, and let EasyProp build your objects:

EasyPropBuilder easyPropBuilder = new EasyPropBuilder();
Foo myFoo = easyPropBuilder.Build<Foo>();

EasyProp uses Castle DynamicProxy internally to do the property intercepting. It's merged into EasyProp binaries, so you only need to reference EasyProp.dll.

These blog posts were helpful for the development of EasyProp:

http://serialseb.blogspot.com/2008/05/implementing-inotifypropertychanged.html

http://hendryluk.wordpress.com/2008/05/28/roll_your_own_cop_part_i_mixins/

Thanks to Frank Quednau, EasyProp 1.1 handles databinding in WPF properly.









Hosted by Google Code