Skip to content

Commit 1eab26c

Browse files
committed
reverts IQuery
1 parent 0543c62 commit 1eab26c

File tree

1 file changed

+23
-5
lines changed
  • src/Umbraco.Core/Persistence/Querying

1 file changed

+23
-5
lines changed

src/Umbraco.Core/Persistence/Querying/IQuery.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@
44

55
namespace Umbraco.Core.Persistence.Querying
66
{
7+
/// <summary>
8+
/// SD: This is a horrible hack but unless we break compatibility with anyone who's actually implemented IQuery{T} there's not much we can do.
9+
/// The IQuery{T} interface is useless without having a GetWhereClauses method and cannot be used for tests.
10+
/// We have to wait till v8 to make this change I suppose.
11+
/// </summary>
12+
internal static class QueryExtensions
13+
{
14+
/// <summary>
15+
/// Returns all translated where clauses and their sql parameters
16+
/// </summary>
17+
/// <returns></returns>
18+
public static IEnumerable<Tuple<string, object[]>> GetWhereClauses<T>(this IQuery<T> query)
19+
{
20+
var q = query as Query<T>;
21+
if (q == null)
22+
{
23+
throw new NotSupportedException(typeof(IQuery<T>) + " cannot be cast to " + typeof(Query<T>));
24+
}
25+
return q.GetWhereClauses();
26+
}
27+
}
28+
729
/// <summary>
830
/// Represents a query for building Linq translatable SQL queries
931
/// </summary>
@@ -17,10 +39,6 @@ public interface IQuery<T>
1739
/// <returns>This instance so calls to this method are chainable</returns>
1840
IQuery<T> Where(Expression<Func<T, bool>> predicate);
1941

20-
/// <summary>
21-
/// Returns all translated where clauses and their sql parameters
22-
/// </summary>
23-
/// <returns></returns>
24-
IEnumerable<Tuple<string, object[]>> GetWhereClauses();
42+
2543
}
2644
}

0 commit comments

Comments
 (0)