-
Notifications
You must be signed in to change notification settings - Fork 1
/
CompositeHavingClause.cs
38 lines (33 loc) · 1.07 KB
/
CompositeHavingClause.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Collections.Generic;
using System.Linq;
namespace Queries.Core.Parts.Clauses;
/// <summary>
/// <para>
/// Allows to combine several <see cref="IHavingClause"/> instances into a single instance.
/// </para>
/// Provides <see cref="Logic"/>
/// </summary>
/// <remarks>
/// Clauses are combined using <see cref="ClauseLogic.And"/> by default.
/// </remarks>
public class CompositeHavingClause : IHavingClause
{
/// <summary>
/// Logical operator used between each <see cref="Clauses"/>' item.
/// </summary>
public ClauseLogic Logic { get; set; }
/// <summary>
/// <see cref="IHavingClause"/>s that are combined
/// </summary>
public IEnumerable<IHavingClause> Clauses { get; set; }
/// <summary>
/// Builds a new <see cref="CompositeHavingClause"/> instance.
/// </summary>
public CompositeHavingClause() => Clauses = Enumerable.Empty<IHavingClause>();
/// <inheritdoc/>
public IHavingClause Clone() => new CompositeHavingClause
{
Logic = Logic,
Clauses = Clauses.Select(x => x.Clone()).ToArray()
};
}