This project is read-only.

How to validate a string inside an array of custom class?

Oct 6, 2009 at 5:04 PM

am using Enterprise Library V4.1 for doing validating my user defined class2 for an application written in .NET 3.5 using C#. I have created 2 classes which look something like this:

class MainBobo
{
public Dictionary<int, Bobo> Category;
}

Class Bobo
{
public string Description;
public Dictionary<int, BoboHelper> MyDirectory;
}

class BoboHelper
{
public string Description;
}

The UI form allows user to enter description for Bobo and BoboHelper on the same form. The user is also allowed to traverse between
different Categories on the same form. The description has to be unique among all the dictionaries.

So my question is how to invoke validation to check for duplicate descriptions? My assumption is that MainBobo is the only one
which knows about all the Bobo objects and Bobo is the only one which knows about all the BoboHelper Objects. But I don't know
how to tell validation method that at any given instance I am trying to validate Description of Bobo class or BoboHelper class.
Also how would it know which validations failed?

I think I have done lousy job explaining this but don't hasitate to ask more questions if this is not clear. Thanks