querybuilder
querybuilder copied to clipboard
NullReferenceException for operations on cloned XQuery
While the changes in #552 solved the issue with timeouts on update and delete operations, it also relies on the existance of a QueryFactory. Unfortunately the QueryFactory is not set on a cloned instance of a QueryFactory-derived Query, which is why a NullReferenceException is raised.
To reproduce:
var db = new QueryFactory(connection, new SqliteCompiler());
var baseQuery = db.Query().From("Users");
var clonedQuery = baseQuery.Clone();
var totalCount = clonedQuery.AsCount().First<int>();
// System.NullReferenceException in SqlKata.Execution/Query.Extensions.cs, line 369