Sorry, I had got my As and Bs mixed. B is a part of A, but B also is
dependent on A in it's validation. It was the reference to A in B which did
not seem appropriate to me. What you say below is actually very valid
though.
My structure is actually that B is a part of A and part of another object
(C). So something like this:
A--C--B1
|
B2
In actuality B1 is dependent on the date values in B2 which is the same
class. With this being the case is validation context object the way to go?
I am not however quite sure what is meant by a validation context object,
especially when you add your note about an interface, could you explain this
concept a little more.
My first thoughts are that the validation context is a wrapper (D) to B with
the validation data referenced within it i.e.:
A--C--D--B1
|
B2
But where does the Interface come in, is it just a 'template' for D,
something like:
interface iMinMaxDate
{
DateTime Max{get;set;}
DateTime Min{get;set;}
D objectD{get; set;}
ValidateDateTimes(DateTime min, DateTime max, DateTime dateToValidate)
}
I hope that this makes sense, or have I really confused matters?
Thanks, Richard
"Lasse Vågsæther Karlsen" <la***@vkarlsen.nowrote in message
news:uF**************@TK2MSFTNGP06.phx.gbl...
RichB wrote:
>Thanks, i had thought along those lines, but didn't think that it was
very oo as B is not really a part of Object A.
If it isn't really a part of object A, then it shouldn't depend on it
either.
Provide a "validation context" type of object to it instead of a "parent",
so that it can validate itself against the context, not necessarily the
"parent". An interface containing just the needed properties is a good way
to go here.
What happens if you have a B without an A?
--
Lasse Vågsæther Karlsen
mailto:la***@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3