/
DB2Options.cs
58 lines (49 loc) · 1.6 KB
/
DB2Options.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
namespace LinqToDB.DataProvider.DB2
{
using Common;
using Common.Internal;
using Data;
/// <param name="BulkCopyType">
/// Default bulk copy mode, used for DB2 by <see cref="DataConnectionExtensions.BulkCopy{T}(DataConnection, IEnumerable{T})"/>
/// methods, if mode is not specified explicitly.
/// Default value: <see cref="BulkCopyType.MultipleRows"/>.
/// </param>
/// <param name="IdentifierQuoteMode">
/// Identifier quotation logic for SQL generation.
/// Default value: <see cref="DB2IdentifierQuoteMode.Auto"/>.
/// </param>
public sealed record DB2Options
(
BulkCopyType BulkCopyType = BulkCopyType.MultipleRows,
DB2IdentifierQuoteMode IdentifierQuoteMode = DB2IdentifierQuoteMode.Auto
// If you add another parameter here, don't forget to update
// DB2Options copy constructor and CreateID method.
)
: DataProviderOptions<DB2Options>(BulkCopyType)
{
public DB2Options() : this(BulkCopyType.MultipleRows)
{
}
DB2Options(DB2Options original) : base(original)
{
IdentifierQuoteMode = original.IdentifierQuoteMode;
}
protected override IdentifierBuilder CreateID(IdentifierBuilder builder) => builder
.Add(IdentifierQuoteMode)
;
#region IEquatable implementation
public bool Equals(DB2Options? other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((IOptionSet)this).ConfigurationID == ((IOptionSet)other).ConfigurationID;
}
public override int GetHashCode()
{
return ((IOptionSet)this).ConfigurationID;
}
#endregion
}
}