Skip to content

Latest commit

 

History

History
73 lines (53 loc) · 1.75 KB

attribute-based-approach.md

File metadata and controls

73 lines (53 loc) · 1.75 KB

Attribute-based approach

Use default input validator

... Example([UseFluentValidation] ExampleInput input) { ... }

Use single validator type for single validator

... Example([UseFluentValidation, UseValidator(typeof(ExampleInputValidator))] ExampleInput input) { ... }

Use single validator type for multiple validators

... Example([UseFluentValidation, UseValidators(typeof(IValidator<ExampleInput>))] ExampleInput input) { ... }

Use validator with custom validation strategy

... Example([
  UseFluentValidation,
  UseValidator(
    typeof(ExampleInputValidator),
    IncludeProperties=new[]{"ExampleProperty"},
    IncludeRuleSets=new[]{"FastValidation"})
  ] ExampleInput input) { ... }

Use validators with custom validation strategy

... Example([
  UseFluentValidation,
  UseValidators(
    typeof(ExampleInputValidator),
    IncludeAllRuleSets=true,
    IncludeRulesNotInRuleSet=true)
  ] ExampleInput input) { ... }

Use default input validator

... Example([UseFluentValidation, UseDefaultInputValidator)] ExampleInput input) { ... }

Use default error mapper

... Example([UseFluentValidation, UseDefaultErrorMapper)] ExampleInput input) { ... }

Use default error mapper with details

... Example([UseFluentValidation, UseDefaultErrorMapperWithDetails)] ExampleInput input) { ... }

Use default error mapper with extended details

... Example([UseFluentValidation, UseDefaultErrorMapperWithExtendedDetails)] ExampleInput input) { ... }

Skip validation

... Example([UseFluentValidation, SkipValidation)] ExampleInput input) { ... }