Transform results
See original GitHub issueIs your feature request related to a problem? Please describe.
When parsing an excel row an object
value can be int, double or string.
A transform validator can determine whether the object is of an allowed type, and if so if it is truly an integer.
Once that processing is done ValidationResult
is returned and if the object is valid, the transform needs to be performed again, since the ValidationResult
does not contain the result.
Describe the solution you’d like
TTransformed? TransformedResult { get; } could be added to ValidationResult
or a type that derives from it such as TransformedValidationResult<T>
Describe alternatives you’ve considered
The alternative to avoiding the transformation is to generate a list of ValidationFailure
s outside the FluentValidation library.
Additional Context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
See the Transform :20 Results
Transform :20 workouts are 20 minutes of fast, intense, hard work that will help sculpt your glutes, chisel your abs, strengthen and define...
Read more >My Transform :20 Step Workout Review Including 6 Week ...
Here's my final review of the Transform :20 workout program from Shaun T. Included are my real life 6 week before and after...
Read more >Transform Behaviors, Transform Results!: Identifying and ...
It proposes a behavioral framework to suit each particular lens. This book begins with reasons most continuous improvement programs fail to deliver the...
Read more >Transform 20: Mom Bod Edition (In-depth Review and ...
Transform 20 is a Beachbody fitness program created and instructed by Shaun T. It is touted as a Transformation process emphasizing fitness, ...
Read more >Transform poller results in the SolarWinds Platform
Click Transform Results, and click Next to acknowledge examples of transformations. Type the name and description for the transformation, and click Next.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It doesn’t need to be on the result - if you instantiate the context directly before calling Validate, you can access the context again after validation has been completed.
If the user needs the int outside of the validator, then it should be parsed/transformed outside of the validator, eg through a surrogate property (or some other solution)
Seems to me that this should be a common issue using transformations. In the documentation example, the string is converted to int. It would seem to me that after a successful validation, the user is likely to need the int again.
So
int.TryParse
is being called twice to do the exact same work. The more expensive transformations and the more instances to validate (such as a huge csv / excel spreadsheet) the slower it will be.I don’t think setting context.RootContextData helps, since it is not available in the
ValidationResult
instance.It is totally possible to have a solution where the string is only parsed once, without using the FluentValidation library, but I was just thinking it could be a common problem.