The new setters for hierarchical properties are handy, but they're missing the property changed notifcation that makes them work properly in WPF. When one of the properties gets reset, it should raise a PropertyChanged event so the bindings will know to get the new value from the property (which will re-create it from the DB).
After a quick check, it appears that Zero to Many, One to One, and Many to Many are missing property changed notification while Many to One has it. Here's the current MyGen template for zero to many:
Code:
set
{
if (value != null) throw new Exception("'value' Must be null");
if (this._<%=objName%> != null)
{
this.RemovePostSave("<%=objName%>");
this._<%=objName%> = null;
}
}
Here's what it should be:
Code:
set
{
if (value != null) throw new Exception("'value' Must be null");
if (this._<%=objName%> != null)
{
this.RemovePostSave("<%=objName%>");
this._<%=objName%> = null;
this.OnPropertyChanged("<%=objName%>"); // <-- new line
}
}
I have this fixed in my local templates, but you'll probably want to get this into the release version templates for the next release.