All Downloads are FREE. Search and download functionalities are using the official Maven repository.

NetStandard.2.1.Rosetta.AbstractRosettaModelObject.cs Maven / Gradle / Ivy

The newest version!
namespace Rosetta.Lib
{
    using Rosetta.Lib.Meta;
    using Rosetta.Lib.Validation;

    /// 
    /// Abstract base class for .
    /// 
    /// Class extending the abstract base class
    public abstract class AbstractRosettaModelObject : IRosettaModelObject where R : AbstractRosettaModelObject
    {
        public abstract IRosettaMetaData MetaData { get; }

        public IValidationResult Validate()
        {
            var metaData = MetaData;
            IValidationResult result = metaData.Validator.Validate((R)this);

            foreach (var validator in metaData.DataRules)
            {
                if (!result.IsSuccess)
                {
                    break;
                }
                result = validator.Validate((R)this);
            }
            foreach (var validator in metaData.ChoiceRuleValidators)
            {
                if (!result.IsSuccess)
                {
                    break;
                }
                result = validator.Validate((R)this);
            }
            return result;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy