Files
Bahla-Back/src/Bahla.Domain/Specifications/Base/CompositeSpecification.cs
2024-10-05 20:36:34 +02:00

18 lines
757 B
C#

namespace Bahla.Domain.Specifications.Base
{
public abstract class CompositeSpecification<T> : ISpecification<T> where T : class
{
public abstract bool IsSatisfiedBy(T entity);
public ISpecification<T> And(ISpecification<T> other)
=> new AndSpecification<T>(this, other);
public ISpecification<T> AndNot(ISpecification<T> other)
=> new AndNotSpecification<T>(this, other);
public ISpecification<T> Not()
=> new NotSpecification<T>(this);
public ISpecification<T> Or(ISpecification<T> other)
=> new OrSpecification<T>(this, other);
public ISpecification<T> OrNot(ISpecification<T> other)
=> new OrNotSpecification<T>(this, other);
}
}