forked from ThatRendle/Simple.Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpressionHasher.cs
More file actions
31 lines (26 loc) · 885 Bytes
/
ExpressionHasher.cs
File metadata and controls
31 lines (26 loc) · 885 Bytes
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
using System.Collections;
using System.Linq;
namespace Simple.Data.Ado
{
using System;
class ExpressionHasher : ExpressionFormatterBase
{
public ExpressionHasher() : base(() => new Operators())
{
}
protected override string FormatObject(object value, object otherOperand)
{
var reference = value as SimpleReference;
return !ReferenceEquals(reference, null) ? reference.ToString() : "?";
}
protected override string FormatRange(IRange range, object otherOperand)
{
return "? AND ?";
}
protected override string FormatList(IEnumerable list, object otherOperand)
{
return string.Format("({0})",
string.Join(",", list.Cast<object>().Select(o => "?")));
}
}
}