コード例 #1
0
        public Derived1DtoValidator(KnxAddressValidator <Derived1Dto> knxAddressValidator)
        {
            RuleFor(_ => _.Number)
            .LessThan(0)
            .When(_ => _.IsNegative)
            ;

            RuleFor(_ => _.KnxAddress)
            .SetValidator(knxAddressValidator)
            ;
        }
コード例 #2
0
        public Derived2DtoValidator(BaseDtoValidator baseValidator, KnxAddressValidator <Derived2Dto> knxAddressValidator)
        {
            RuleFor(o => o)
            .SetValidator(baseValidator)
            ;

            RuleFor(_ => _.Temperature)
            .ExclusiveBetween(10F, 30F)
            ;

            RuleFor(_ => _.KnxAddress)
            .SetValidator(knxAddressValidator)
            ;

            RuleFor(_ => _.KnxAddress2)
            .SetValidator(knxAddressValidator)
            ;
        }