Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to use validator tools, but one day ago I didn't get any errors about this entity thing and now I am getting an error about entity. What should I do in order to not get an error?

What I have tried:

C#
public static class ValidatorTool
    {
        public static bool Validate(IValidator validator,IEntity entity)
        {
            bool result = true;
            var validationResult = validator.Validate(entity);
            if (!validationResult.IsValid)
            {
                string message = null;
                foreach (var error in validationResult.Errors)
                {
                    message += error.ErrorMessage+System.Environment.NewLine;
                }
                MessageBox.Show(message);
                result = false;
            }
            return result;
Posted
Updated 2-Feb-22 3:57am
v2
Comments
Graeme_Grant 2-Feb-22 10:24am    
The clue is in the error message ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900