﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>John Rusk commented on An easier way to manage INotifyPropertyChanged</title><description>Here's another alternative 
[http://www.codeplex.com/ActiveSharp](http://www.codeplex.com/ActiveSharp)  
  
Properties have their real types (no .Value) .
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment32</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment32</guid><pubDate>Tue, 11 Aug 2009 09:15:25 GMT</pubDate></item><item><title>Matt Fenner commented on An easier way to manage INotifyPropertyChanged</title><description>"Jonathon,
  
I really hate all the craft that you need to get it working"
  
  
I would argue that there is more craft here. Also Dependency Properties are implemented in a way which actually makes them perform better in bindings because the framework doesn't have to use reflection.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment31</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment31</guid><pubDate>Mon, 10 Aug 2009 01:51:16 GMT</pubDate></item><item><title>Ayende Rahien commented on An easier way to manage INotifyPropertyChanged</title><description>Micahel,
  
In about 12 hours there is going to be a post about Conditions and Facts, take a look at this
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment30</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment30</guid><pubDate>Sun, 09 Aug 2009 21:07:10 GMT</pubDate></item><item><title>Michael L Perry commented on An easier way to manage INotifyPropertyChanged</title><description>Ayende,
  
  
Fair enough. Could you demonstrate then how you would update your view model from the data model? For example, set AllowEditing when certain conditions are true?
  
  
The reason I define a view model to have no storage is because it allows you to write what AllowEditing means in just one place: the getter. If it has storage, you have to set that storage from someplace else, usually from a property changed event handler. That's seems like extra work to me. I'm curious to see how you solve that.
  
  
Thanks.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment29</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment29</guid><pubDate>Sun, 09 Aug 2009 20:28:41 GMT</pubDate></item><item><title>chris Donnan commented on An easier way to manage INotifyPropertyChanged</title><description>Radenko;
  
  
Validation is a separate concern. We have CommandModels ala this 
[blogs.msdn.com/.../756095.aspx](http://blogs.msdn.com/dancre/archive/2006/09/15/756095.aspx)  
Each CommandModel has a Validator on it. Each validator is essentially a Func
&lt;t,validationresult&gt;
 where the result has potential messages and a bool on it. This lets us compose validations together using a CompositeValidator (list of those Funcs basically).  Each command is bound to the UI, we bind all our validators to enable the commands and to show messages (eg; we put tooltips over disabled buttons with the errors etc).
  
  
That is about it.
  
Chris
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment28</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment28</guid><pubDate>Sun, 09 Aug 2009 15:08:23 GMT</pubDate></item><item><title>Ayende Rahien commented on An easier way to manage INotifyPropertyChanged</title><description>Michael,
  
Then we don't share the same definition at all. 
  
The model in the post is my view model.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment27</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment27</guid><pubDate>Sun, 09 Aug 2009 10:51:48 GMT</pubDate></item><item><title>Radenko Zec commented on An easier way to manage INotifyPropertyChanged</title><description>Ayende nice code. 
  
Chris Donnan how to do some additional validation on properties then? 
  
  
Thanks
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment26</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment26</guid><pubDate>Sun, 09 Aug 2009 09:17:11 GMT</pubDate></item><item><title>Chris Donnan commented on An easier way to manage INotifyPropertyChanged</title><description>I have done this for our WPF based projects for ~1 year. I have been calling this PropertyModel. We have also included other presentation specific per-property metadata in our property model types.
  
  
IPropertyModel
&lt;t : INotifyPropertyChanged {
  
  T Value
  
  bool IsEditable
  
  string CustomEditorName
  
  void SignalChanged()
  
  ...etc
  
} 
  
  
This has made many of our binding scenarios much cleaner. We have also made a series of policies that toggle propertymodel settings. This has given us generally more reuse of common screens. For example our New and Edit screens are the same. The edit screens let us flip certain IsEditable values to false and so on.
  
  
'Serial related properties' often manifest in classes like:
  
  
class X {
  
   Foo a;
  
  bool isADirty;
  
  bool wasAUserEntered;
  
}
  
  
This initial smell + the ugly repetitive INotifyPropertyChanged business helped us to normalise our property related data into 1 PropertyModel.
  
  
PropertyModel + ViewModel + CommandModels (ala Dan Crevier) is our essential WPF model.
  
  
-Chris-
&gt;</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment25</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment25</guid><pubDate>Sun, 09 Aug 2009 07:37:32 GMT</pubDate></item><item><title>Andrey Shchekin commented on An easier way to manage INotifyPropertyChanged</title><description>You can also pick Obtics (
[http://obtics.codeplex.com/](http://obtics.codeplex.com/)), and you'll get real-time updates for calculated values (including Linq). I really love real-time Linq with WPF -- it completely removes the need to think what changed when and what was affected.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment24</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment24</guid><pubDate>Sun, 09 Aug 2009 07:07:49 GMT</pubDate></item><item><title>Michael L Perry commented on An easier way to manage INotifyPropertyChanged</title><description>Ayende,
  
  
The distinction I draw between Model (or more precisely Data Model) and View Model is this. A Data Model is persistent. A View Model is dependent.
  
  
What you've proposed here works for the Data Model because it has storage. But it does not work for a View Model. A View Model has no storage; all of its properties are calculations that bring together properties of the Data Model.
  
  
For example:
  
  
class ContactListViewModel
  
{
  
  public string Title
  
  {
  
    get
  
    {
  
      Person selectedPerson = _navigation.SelectedPerson;
  
      return "Contacts - " + selectedPerson.LastName + ", " + selectedPerson.FirstName;
  
    }
  
  }
  
}
  
  
Navigation and Person both persist data (Navigation only temporarily, but Person persistently). ContactListViewModel stores nothing. It's properties are dependent on others.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment23</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment23</guid><pubDate>Sun, 09 Aug 2009 04:13:18 GMT</pubDate></item><item><title>Damien Guard commented on An easier way to manage INotifyPropertyChanged</title><description>Implicit operators can be called with null so you should put a check there to return null or you may end up with null reference errors acessing .value.
  
  
[)amien
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment22</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment22</guid><pubDate>Sat, 08 Aug 2009 20:46:10 GMT</pubDate></item><item><title>Frank Quednau commented on An easier way to manage INotifyPropertyChanged</title><description>You wouldn't believe how annoying I find the lost instance issue with the reverse implicit operator :)
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment21</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment21</guid><pubDate>Sat, 08 Aug 2009 20:24:31 GMT</pubDate></item><item><title>Ayende Rahien commented on An easier way to manage INotifyPropertyChanged</title><description>Michael,
  
Make a distinction between a model and view model
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment20</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment20</guid><pubDate>Sat, 08 Aug 2009 19:51:59 GMT</pubDate></item><item><title>Ayende Rahien commented on An easier way to manage INotifyPropertyChanged</title><description>Mark,
  
Both ways meaning implementing two way implicit conversion operators.
  
The problem is that it would generate different instances.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment19</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment19</guid><pubDate>Sat, 08 Aug 2009 19:50:00 GMT</pubDate></item><item><title>John Chapman commented on An easier way to manage INotifyPropertyChanged</title><description>First, I don't think I would ever use something like this.  I don't mind the extra work, and using the wrapper classes seems like just as much extra work anyway.  You've also introduced .Value all over your usages (no implicit conversion on assignment).
  
  
That being said, why did you choose to use a class instead of a struct?  I would actually expect to keep value semantics versus reference semantics.  It seems very odd to wrap up an integer as a class to me.  You also have potential performance improvements (thought doubtful to matter in 99% of the applications out there) considering that many view model type objects contain a significant number of value types.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment18</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment18</guid><pubDate>Sat, 08 Aug 2009 18:23:34 GMT</pubDate></item><item><title>Michael Sync commented on An easier way to manage INotifyPropertyChanged</title><description>I'm regular reader of your blog but for this one, I don't agree with you. I prefer to have the actual type (e.g.  int PersonID ) instead of this (e.g. Observe
&lt;int PersonID ). I feel like it makes my Model look ugly.  Sorry. 
&gt;</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment17</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment17</guid><pubDate>Sat, 08 Aug 2009 17:41:23 GMT</pubDate></item><item><title>Justin Chase commented on An easier way to manage INotifyPropertyChanged</title><description>You might want to pick a name other than Observable
&lt;t since there actually will be an Observable
&lt;t in .net 4 which does something very different. 
  
  
[themechanicalbride.blogspot.com/.../...events.html](http://themechanicalbride.blogspot.com/2009/07/introducing-rx-linq-to-events.html)&gt;  
  
If you haven't seen this yet you should definitely check it out, very brain bending and revelatory. My favorite quote:
  
  
"To put things in perspective it’s been 13 years since Design Patterns was published and we’ve only now realized that the Observable pattern and the Iterator pattern are actually the same pattern."
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment16</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment16</guid><pubDate>Sat, 08 Aug 2009 16:55:03 GMT</pubDate></item><item><title>Mark Nijhof commented on An easier way to manage INotifyPropertyChanged</title><description>Sorry, you said "you can treat the object as if it wasn’t a wrapper for reading purposes. I could make it both ways" I understand how this works for reading, but I didn't know you could do the same for writing values to the .Value property.
  
  
F.ex: AllowEditing = true would work than?
  
  
-Mark
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment15</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment15</guid><pubDate>Sat, 08 Aug 2009 15:27:03 GMT</pubDate></item><item><title>Ayende Rahien commented on An easier way to manage INotifyPropertyChanged</title><description>I don't understand the question
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment14</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment14</guid><pubDate>Sat, 08 Aug 2009 15:23:56 GMT</pubDate></item><item><title>Mark Nijhof commented on An easier way to manage INotifyPropertyChanged</title><description>How can you make the wrapper both ways?
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment13</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment13</guid><pubDate>Sat, 08 Aug 2009 15:23:02 GMT</pubDate></item><item><title>Michael L Perry commented on An easier way to manage INotifyPropertyChanged</title><description>Here's an even easier way. Don't! 
[http://updatecontrols.net](http://updatecontrols.net)  
  
Update Controls automatically discovers dependencies among your properties and updates your WPF, Silverlight, and even Winforms controls.
  
  
The problem with INotifyPropertyChanged is not firing events. It's being the middle man. The View Model layer is hard to write because you have to respond to changes in the Data Model, update yourself, and forward events to the View. But when you use Update Controls, there is no data binding code in the View Model at all.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment12</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment12</guid><pubDate>Sat, 08 Aug 2009 14:17:57 GMT</pubDate></item><item><title>FallenGameR commented on An easier way to manage INotifyPropertyChanged</title><description>And how would you implement validation if it is needed? Extend Observable with 'void Validation( string propertyName )'?
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment11</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment11</guid><pubDate>Sat, 08 Aug 2009 13:49:03 GMT</pubDate></item><item><title>Ayende Rahien commented on An easier way to manage INotifyPropertyChanged</title><description>Fallen,
  
I don't as of yet. I'll deal with that if/when I run into that scenario
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment10</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment10</guid><pubDate>Sat, 08 Aug 2009 13:34:18 GMT</pubDate></item><item><title>FallenGameR commented on An easier way to manage INotifyPropertyChanged</title><description>What about validation?
  
  
In WPF it's convinient to run validation in properties. When validation fails exception is thrown and 'ValidatesOnExceptions=True' in binding allows to visually accent wrong field and show tooltip with explanation.
  
  
How do you propose to handle validation?
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment9</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment9</guid><pubDate>Sat, 08 Aug 2009 13:19:48 GMT</pubDate></item><item><title>Stephen commented on An easier way to manage INotifyPropertyChanged</title><description>Yea postsharp is a potential, more and more recently I've been thinking about what I think is one of the lacking areas in '.NET', and thats where we don't have really any control at compilation time (sure we can do pre-processors etc but thats not exactly simple)..
  
  
There are tons of places we end up pushing complex work to runtime that could well be evaluated once at compile time, I really think .NET needs a built in system that runs after compilation to IL, and can run transforms.. just as postsharp is allowing.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment8</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment8</guid><pubDate>Sat, 08 Aug 2009 13:14:36 GMT</pubDate></item><item><title>Ayende Rahien commented on An easier way to manage INotifyPropertyChanged</title><description>Jonathon,
  
I really hate all the craft that you need to get it working
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment7</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment7</guid><pubDate>Sat, 08 Aug 2009 13:12:29 GMT</pubDate></item><item><title>Ayende Rahien commented on An easier way to manage INotifyPropertyChanged</title><description>Liviu,
  
You wouldn't be able to measure that in any meaningful way
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment6</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment6</guid><pubDate>Sat, 08 Aug 2009 13:11:41 GMT</pubDate></item><item><title>Sean Kearon commented on An easier way to manage INotifyPropertyChanged</title><description>Also worth checking out PostSharp (
[www.postsharp.org](http://www.postsharp.org)) for a solution to this.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment5</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment5</guid><pubDate>Sat, 08 Aug 2009 13:04:11 GMT</pubDate></item><item><title>Fred Hirschfeld commented on An easier way to manage INotifyPropertyChanged</title><description>The default VS2008 WCF service proxy generator already takes care of the INotifyPropertyChanged on your model objects at least for Silverlight.
  
  
I am thinking to augment this so it will also add the IEditableObject like I think the RIA Services does.
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment4</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment4</guid><pubDate>Sat, 08 Aug 2009 11:12:47 GMT</pubDate></item><item><title>Philipp Sumi commented on An easier way to manage INotifyPropertyChanged</title><description>Thinking outside the box pays off I'd say - smart solution :)
</description><link>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment3</link><guid>http://ayende.com/4107/an-easier-way-to-manage-inotifypropertychanged#comment3</guid><pubDate>Sat, 08 Aug 2009 10:46:41 GMT</pubDate></item></channel></rss>