Or

Feature Is supported
Null safe
Validation
EF Core
EF 6

Info

Join Specifications as logical OR.

Usage (A || B)

Specification
    .True()
    .Or()
    .True()
    .IsSatisfiedBy(true);   // true

Specification
    .True()
    .Or()
    .False()
    .IsSatisfiedBy(true);   // true

Specification
    .False()
    .Or()
    .False()
    .IsSatisfiedBy(true);   // false

Below all examples, generate the same result.

Specification
    .NotNull<string>()
    .Or()
    .NotEmail();

Specification
    .NotNull<string>()
    .Or(Specification
        .Email());

// Create EmailSpecification with parameter-less constructor
Specification
    .NotNull<string>()
    .Or<string, EmailSpecification>();

Grouping

A || (B && C)

Specification
    .NotEmpty<string>()
    .Or(Specification
        .Contains("lorem")
        .And()
        .Contains("ipsum"));

(A && B) || C

Specification
    .Or(Specification
            .Contains("lorem")
            .And()
            .Contains("ipsum"), 
        Specification
            .NotEmpty<string>());

(A && B) || (C && D)

Specification
    .Or(Specification
            .NotEmpty<string>()
            .And()
            .Length(10),
        Specification
            .Contains("lorem")
            .And()
            .Contains("ipsum"));

Or Not (A || !B)

Specification
    .True()
    .OrNot()
    .True()
    .IsSatisfiedBy(true);   // true

Specification
    .False()
    .OrNot()
    .True()
    .IsSatisfiedBy(true);   // false

Specification
    .False()
    .OrNot()
    .False()
    .IsSatisfiedBy(true);   // true

Grouping

A || !(B && C)

Specification
    .NotEmpty<string>()
    .OrNot(Specification
        .Contains("lorem")
        .And()
        .Contains("ipsum"));

(A && B) || !C

Specification
    .OrNot(Specification
            .Contains("lorem")
            .And()
            .Contains("ipsum"), 
        Specification
            .NotEmpty<string>());

(A && B) || !(C && D)

Specification
    .OrNot(Specification
            .NotEmpty<string>()
            .And()
            .Length(10),
        Specification
            .Contains("lorem")
            .And()
            .Contains("ipsum"));
GitHub