CompositeSpecification<T> Class

Summary

Base implementation of IComplexSpecification<T> for composite Specifications like And, Or.
graph BT Type-->Base0["object"] Type-.->Interface0["IComplexSpecification<T>"] Type-.->Interface1["IValidationSpecification<T>"] Type-.->Interface2["ILinqSpecification<T>"] Type-.->Interface3["ILinqSpecification"] click Interface3 "/FluentSpecification/api/FluentSpecification.Abstractions/ILinqSpecification" Type-.->Interface4["ISpecification<T>"] Type-.->Interface5["ISpecification"] click Interface5 "/FluentSpecification/api/FluentSpecification.Abstractions/ISpecification" Type["CompositeSpecification<T>"] class Type type-node Derived0["AndSpecification<T>"]-->Type click Derived0 "/FluentSpecification/api/FluentSpecification.Core.Composite/AndSpecification_1" Derived1["OrSpecification<T>"]-->Type click Derived1 "/FluentSpecification/api/FluentSpecification.Core.Composite/OrSpecification_1"

Syntax

[PublicAPI]
public abstract class CompositeSpecification<T> : IComplexSpecification<T>, 
    IValidationSpecification<T>, ILinqSpecification<T>, ILinqSpecification, ISpecification<T>, 
    ISpecification

Attributes

Type Description
PublicAPI

Type Parameters

Name Description
T Type of candidate to verify.

Constructors

Name Summary
CompositeSpecification(ISpecification<T>, ISpecification<T>, Func<Expression, Expression, Expression>) Creates base composite object with correct Linq Expression.

Properties

Name Value Summary
TraceMessageConnector string
String used as connection between trace message from "left" and "right" Specifications.

Methods

Name Value Summary
GetExpression() Expression<Func<T, bool>>
Gets typed lambda Linq Expression with candidate object verification. Expression is composed by two separate Linq Expressions, from Specifications passed in constructor.
IsSatisfiedBy(T) bool
Merge results from Specifications passed in constructor.
IsSatisfiedBy(T, SpecificationResult) bool
Merge results from Specifications passed in constructor.
Merge(bool, bool) bool
Gets overall merge result

Operators

Name Value Summary
explicit operator Expression(CompositeSpecification<T>) Expression
implicit operator Expression<Func<T, bool>>(CompositeSpecification<T>) Expression<Func<T, bool>>
implicit operator Func<T, bool>(CompositeSpecification<T>) Func<T, bool>

Extension Methods

Name Value Summary
And<T, TSpecification>() IComplexSpecification<T>
Creates logical AND Specification with newly created TSpecification.
And<T>() ICompositeSpecification<T>
Creates composite Specification proxy for final logical AND Specification.
And<T>(ISpecification<T>) IComplexSpecification<T>
Creates logical AND Specification.
AndNot<T, TSpecification>() IComplexSpecification<T>
Creates logical AND Specification with newly created and negated TSpecification.
AndNot<T>() ICompositeSpecification<T>
Creates composite Specification proxy for final logical AND Specification. Second Specification is negated.
AndNot<T>(ISpecification<T>) IComplexSpecification<T>
Creates logical AND Specification with negated other.
AsComplexSpecification<T>() IComplexSpecification<T>
Converts Specification to complex Specification.
AsExpression<T>() Expression<Func<T, bool>>
Converts Specification to Linq Expression<T>.
AsPredicate<T>() Func<T, bool>
Converts Specification to Func<T, TResult> predicate.
Not<T>() IComplexSpecification<T>
Creates logical NOT Specification.
Or<T, TSpecification>() IComplexSpecification<T>
Creates logical OR Specification with newly created TSpecification.
Or<T>() ICompositeSpecification<T>
Creates composite Specification proxy for final logical OR Specification.
Or<T>(ISpecification<T>) IComplexSpecification<T>
Creates logical OR Specification.
OrNot<T, TSpecification>() IComplexSpecification<T>
Creates logical OR Specification with newly created and negated TSpecification.
OrNot<T>() ICompositeSpecification<T>
Creates composite Specification proxy for final logical OR Specification. Second Specification is negated.
OrNot<T>(ISpecification<T>) IComplexSpecification<T>
Creates logical OR Specification with negated other.
WithMessage<T>(Func<T, IReadOnlyDictionary<string, object>, string>) IComplexSpecification<T>
Creates validation Specification proxy with specific error message factory where not satisfied by.
WithMessage<T>(Func<T, string>) IComplexSpecification<T>
Creates validation Specification proxy with specific error message factory where not satisfied by.
WithMessage<T>(string) IComplexSpecification<T>
Creates validation Specification proxy with specific error message where not satisfied by.
GitHub