-
-
Notifications
You must be signed in to change notification settings - Fork 524
Expand file tree
/
Copy pathXQuery.cs
More file actions
49 lines (38 loc) · 1.39 KB
/
XQuery.cs
File metadata and controls
49 lines (38 loc) · 1.39 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
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using SqlKata.Compilers;
namespace SqlKata.Execution
{
public class XQuery : Query
{
public IDbConnection Connection { get; set; }
public Compiler Compiler { get; set; }
public Action<SqlResult> Logger = result => { };
public QueryFactory QueryFactory { get; set; }
public XQuery(IDbConnection connection, Compiler compiler)
{
this.QueryFactory = new QueryFactory(connection, compiler);
this.Connection = connection;
this.Compiler = compiler;
}
public override Query Clone()
{
var query = new XQuery(this.QueryFactory.Connection, this.QueryFactory.Compiler);
if (this.QueryFactory?.QueryTimeout != null)
{
query.QueryFactory.QueryTimeout = this.QueryFactory?.QueryTimeout ?? 30;
}
query.Clauses = this.Clauses.Select(x => x.Clone()).ToList();
query.Logger = this.Logger;
query.QueryAlias = QueryAlias;
query.IsDistinct = IsDistinct;
query.Method = Method;
query.Includes = Includes.Select(i => i.Clone()).ToList();
query.Variables = new Dictionary<string, object>(Variables);
query.SetEngineScope(EngineScope);
return query;
}
}
}