You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specification<object[]>specification= s =>s.AsCollection(itemSpecification).WithAsyncStrategy();// will use some default strategy
// will use the async version only if more than 10k items, validating 100 items in a single task:Specification<object[]>specification= s =>s.AsCollection(itemSpecification).WithAsyncStrategy(bulkSize:100,minCount:10000);
varresult1=validator.Validate(hugeCollection);// under the hood it triggers async collection validation anywayvarresult2=awaitvalidator.Validate(hugeCollection);// same as above, but bubbles up the task?
Feature details
Async strategy would be used for collections only (parameter command that affects AsCollection).
Task orchestration done with task scheduler set in the settings.
ValidationContext would need to be created for each bulk and at the end - all the contexts from all of the bulks would be merged into the master one.
At the same time, it would be nice that the original ValidationContext continue with the regular validation in other places.
The text was updated successfully, but these errors were encountered:
After a lot of offline discussions, I decided to postpone it a little bit. In the vast majority of cases, async/await support is not needed. There are only two justifications for that:
The predicates are awaitable
And Validot doesn't support this approach either now and in the foreseeable future. The validation logic should be quick and straightforward (or at least static) without calling external services or querying remote databases.
In this case, Validot follows a different path than FluentValidation.
Large collections.
This is a valid case, described in this issue's description. However, it's a low priority matter.
I'm closing this down. Validot will not be supporting awaitable predicates as rules.
Large collections are a separate issue and I've heard user voices encouraging me to address it... but I don't think that anything similar to WithAsyncStrategy is the solution.
Most probably it will be handled with a separate, dedicated validator. Imagine something more like:
Feature description
Validate
method.Feature in action
Feature details
AsCollection
).The text was updated successfully, but these errors were encountered: