예제 #1
0
        public AssetsValidator(bool isRequired, AssetsFieldProperties properties, CheckAssets checkAssets)
        {
            Guard.NotNull(properties, nameof(properties));
            Guard.NotNull(checkAssets, nameof(checkAssets));

            this.properties = properties;

            if (isRequired || properties.MinItems.HasValue || properties.MaxItems.HasValue)
            {
                collectionValidator = new CollectionValidator(isRequired, properties.MinItems, properties.MaxItems);
            }

            if (!properties.AllowDuplicates)
            {
                uniqueValidator = new UniqueValuesValidator <DomainId>();
            }

            this.checkAssets = checkAssets;
        }