BrokenRulesCollection - not including child?

BrokenRulesCollection - not including child?

Old forum URL: forums.lhotka.net/forums/t/229.aspx


JonnyBasic posted on Tuesday, May 30, 2006

I could be wrong here or maybe I implemented something incorrectly, but here is my scenerio.

Child : BusinessBase<Child>
{ }
Parent : BusinessBase<Parent>
{
   Child _child;
   Child Child
   { get return _child; }
}

I'm assuming this is the standard move here. The problem that I'm having is that when I bind to a control like so

bindingSourceParent.DataSource = myParent;
bindingSourceChild.DataSource = myParent.Child;

and then make a modification to the child (which in turn invalidates the child) when I show the broken rules for the parent, the child items are not included. Since IsValid has been overriden to check (_child.IsValid && base.IsValid) do I need do something special to get all the broken rules of the children into the parent's collection?

Thanks,
JB

RockfordLhotka replied on Tuesday, May 30, 2006

You are correct that the information doesn't flow up automatically.

Since the broken rules list is maintained on a per-property basis, how would you expect the broken rules to appear in the parent - collapsed so they all appear to belong to the Child property?

Given a more complex object graph, would you expect grandchild and great-grandchild entries to also be listed as part of the Child property (because the root object has no property for the grandchildren, etc)?

None of this would work with IDataErrorInfo - other than perhaps the Error property from that interface could list all the broken rules for all the objects in the graph. That could be highly misleading in a grid however, as the tooltip would list errors that couldn't be fixed by changing values in the visible cells. It seems to me that the user experience in such a scenario would be very odd.

Copyright (c) Marimer LLC