示例#1
0
        public DistinguishedNameParser(IDistinguishedNameComponentValidator distinguishedNameComponentValidator)
        {
            if (distinguishedNameComponentValidator == null)
            {
                throw new ArgumentNullException("distinguishedNameComponentValidator");
            }

            this._distinguishedNameComponentValidator = distinguishedNameComponentValidator;
        }
示例#2
0
        public DistinguishedNameComponent(string name, string value, IDistinguishedNameComponentValidator distinguishedNameComponentValidator)
        {
            if (distinguishedNameComponentValidator == null)
            {
                throw new ArgumentNullException("distinguishedNameComponentValidator");
            }

            var validationResult = distinguishedNameComponentValidator.ValidateName(name);

            if (!validationResult.IsValid)
            {
                throw validationResult.Exceptions.First();
            }

            validationResult = distinguishedNameComponentValidator.ValidateValue(value);

            if (!validationResult.IsValid)
            {
                throw validationResult.Exceptions.First();
            }

            this._name  = name;
            this._value = value;
        }