feat: builders, specifications

This commit is contained in:
Kylnic28
2024-10-05 20:36:34 +02:00
parent 4811837ca6
commit 17a7e651c8
24 changed files with 422 additions and 17 deletions

View File

@@ -0,0 +1,17 @@
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);
}
}