Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement specification validators. #193

Merged
merged 10 commits into from
Jan 12, 2022
Merged

Implement specification validators. #193

merged 10 commits into from
Jan 12, 2022

Conversation

fiseni
Copy link
Collaborator

@fiseni fiseni commented Dec 22, 2021

Closes #111. This should be merged after PR #192.

This feature offers the possibility to check if an entity satisfies the conditions in a given specification. Since it's a single entity, it's being validated only against expressions/conditions specified in Where and Search, and everything else is omitted during this process. The usage is quite simple

var customer = new Customer { Name = "something" };
var spec = new CustomerByNameSpec("something");
var result = spec.IsSatisfiedBy(customer)

The implementation uses a separate infrastructure for this feature, by introducing new constructs ISpecificationValidator and IValidator (partial validator). I decided not to use the in-memory evaluators, since we'll force omitted evaluators to implement IsValid(), which is not nice.

@fiseni fiseni requested a review from ardalis December 22, 2021 12:53
@ardalis
Copy link
Owner

ardalis commented Jan 12, 2022

Needs docs.

@ardalis ardalis merged commit 5e0cddd into main Jan 12, 2022
@fiseni fiseni deleted the specification-validators branch January 12, 2022 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluate Specification for one Entity
2 participants