-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMultiSetSingleArgs.cs
More file actions
43 lines (37 loc) · 1.79 KB
/
MultiSetSingleArgs.cs
File metadata and controls
43 lines (37 loc) · 1.79 KB
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
39
40
41
42
43
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/CoreEx
namespace CoreEx.Database
{
/// <summary>
/// Provides the base <b>Database</b> multi-set arguments when expecting a single item/record only.
/// </summary>
/// <param name="isMandatory">Indicates whether the value is mandatory; defaults to <c>true</c>.</param>
/// <param name="stopOnNull">Indicates whether to stop further query result set processing where the current set has resulted in a null (i.e. no records).</param>
public abstract class MultiSetSingleArgs(bool isMandatory = true, bool stopOnNull = false) : IMultiSetArgs
{
/// <summary>
/// Indicates whether the value is mandatory; i.e. a corresponding record must be read.
/// </summary>
public bool IsMandatory { get; set; } = isMandatory;
/// <summary>
/// Gets the minimum number of rows allowed.
/// </summary>
public int MinRows => IsMandatory ? 1 : 0;
/// <summary>
/// Gets the maximum number of rows allowed.
/// </summary>
public int? MaxRows => 1;
/// <summary>
/// Indicates whether to stop further query result set processing where the current set has resulted in a null (i.e. no records).
/// </summary>
public bool StopOnNull { get; set; } = stopOnNull;
/// <summary>
/// The <see cref="DatabaseRecord"/> method invoked for each record for its respective dataset.
/// </summary>
/// <param name="dr">The <see cref="DatabaseRecord"/>.</param>
public abstract void DatasetRecord(DatabaseRecord dr);
/// <summary>
/// Invokes the corresponding result function.
/// </summary>
public virtual void InvokeResult() { }
}
}