I have an Item BO - it is comprised of three classes: ItemSKU (Editable Object), ItemSplits (a child list) and ItemSplit (an editable child).
The problem is this: the ItemSKU object's validation of its own variables works fine, however, validation of the ItemSplit object does not appear to occur. I have added the validation rules to the child object, but it just returns IsValid=true even when it is obviously not.
I appreciate that this is a tricky question without an example of the relevant code, but I was wondering whether anyone else had had this experience and may be kind enough to give me some tips.
Thanks
Bonio
Hi Dawn
I am using this in my ItemSKU class:
public override bool IsValid{
get { return base.IsValid && _splits.IsValid; }}
For whatever reason the ItemSKU validation is working, but not validation for ItemSplits??
Thanks
Bonio
Okay, I think I have found the problem :
It the set property of some of my string variables, I have the following:
set{
CanWriteProperty(
"Description", true); if (value == null) value = string.Empty; if (!_description.Equals(value)){
_description =
value;PropertyHasChanged(
"Description");}
The reason for the problem was I was initializing my variable '_description' to be 'String.Empty', when a user fails to enter a value in 'Description' it remains as 'String.Empty' and therefore the 'PropertyHasChanged' method is not called. Any ideas how I should get round this? I tried not initializing to 'String.Empty' but had problems.
Thanks
Bonio
Having done a bit more research, I have fixed the problem by putting
Validation.CheckRules() in the child's constructor. Is the correct way?
Thanks
Bonio
Copyright (c) Marimer LLC