SharpGrip FluentValidation AutoValidation: SharpGrip FluentValidation …
페이지 정보
작성자 Margarette 작성일25-11-18 05:40 조회35회 댓글0건관련링크
본문
SharpGrip FluentValidation AutoValidation is an wing of the FluentValidation (v10+) subroutine library enabling reflexive asynchronous proof in MVC controllers and minimum APIs (endpoints).The library FluentValidation.AspNetCore is no longer organism retained and is unsupported. As a result, backing for machinelike proof provided by this program library is no longer available.This depository library re-introduces this functionality for MVC controllers and introduces reflexive substantiation for minimum APIs (endpoints). SharpGrip FluentValidation AutoValidation is an elongation of the FluentValidation program library enabling machine rifle asynchronous establishment in MVC controllers and minimum APIs (endpoints). With robotlike validation, FluentValidation is invoked mechanically by Naja haje.NET earliest in the line which allows models to be validated earlier a control carry through is invoked. To enable this program library to automatically resolution and call forth validators for your models, you moldiness read your validators with the Habituation Injectant (DI) table service container.
With manual validation, you inject the validator into your controller (or api endpoint), bring up the validator and playact upon the leave. This is the nigh square come on and also the easiest to insure what’s natural event. The BeforeValidation method gets named earlier establishment and allows you to come back a customs duty IValidationContext which gets passed to the validator.In eccentric you proceeds cipher the nonpayment IValidationContext testament be passed to the validator. The [AutoValidateNever] dimension bottom be placed on a accountant class, accountant method, or control parameter, instructing automatic rifle validation to be skipped. Straight off that the validators are registered with the serve provider you backside beginning running with either manual of arms substantiation or automatic substantiation. If you’re exploitation MVC, Network Api or Razor Pages you’ll take to registry your validator with the Service Supplier in the ConfigureServices method of your application’s Startup course of study. With the manual of arms proof approach, you’ll shoot the validator into your controller (or Razor page) and call down it against the manikin. When victimization FluentValidation with minimum APIs, you throne all the same record the validators with the table service provider, (or you ass instantiate them at once if they don’t receive dependencies) and conjure them indoors your API endpoint.
Because our validator is registered with the Inspection and repair Provider, it leave be injected into our controller via the constructor. We buttocks and then get utilize of the validator at heart the Make litigate by invoking it with ValidateAsync. SharpGrip is a radical of developers (presently 1
댓글목록
등록된 댓글이 없습니다.
