File tree 1 file changed +23
-5
lines changed
src/Umbraco.Core/Persistence/Querying 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace Umbraco . Core . Persistence . Querying
6
6
{
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
+
7
29
/// <summary>
8
30
/// Represents a query for building Linq translatable SQL queries
9
31
/// </summary>
@@ -17,10 +39,6 @@ public interface IQuery<T>
17
39
/// <returns>This instance so calls to this method are chainable</returns>
18
40
IQuery < T > Where ( Expression < Func < T , bool > > predicate ) ;
19
41
20
- /// <summary>
21
- /// Returns all translated where clauses and their sql parameters
22
- /// </summary>
23
- /// <returns></returns>
24
- IEnumerable < Tuple < string , object [ ] > > GetWhereClauses ( ) ;
42
+
25
43
}
26
44
}
You can’t perform that action at this time.
0 commit comments