root/src/FmwkPoiesis.ObjectSearchProvider.Hql/HqlObjectSearchProvider.cs
| 3 | 4 | ||
|---|---|---|---|
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Linq; | 3 | using System.Linq; |
4 | using System.Text; | 4 | using System.Text; |
5 | using Poiesis.FrameWork.ObjectSearch; | 5 | using Poiesis.FrameWork.ObjectSearch; |
6 | 6 | ||
7 | namespace FmwkPoiesis.ObjectSearchProvider.Hql | 7 | namespace FmwkPoiesis.ObjectSearchProvider.Hql |
8 | { | 8 | { |
9 | public class HqlObjectSearchProvider : IObjectSearchProvider | 9 | public class HqlObjectSearchProvider : IObjectSearchProvider |
10 | { | 10 | { |
11 | public string BuildCommandEqual<T>(Equal<T> comparator, bool isLast) where T : IComparable | 11 | public string Name |
12 | { | 12 | { |
13 | string command = String.Format("({0} = {1})", comparator.NameProperty, comparator.ValueToCompare.ToString()); | 13 | get { return "HQLProvider"; } |
14 | } | ||
14 | 15 | ||
16 | public string BuildCommandEqual<T>(Equal<T> comparator, bool isLast) where T : IComparable | ||
17 | { | ||
18 | string command = String.Format("({0} = {1})", comparator.NameProperty, comparator.ValueToCompare.ToString()); | ||
19 | |||
15 | if (isLast) | 20 | if (isLast) |
16 | return command; | 21 | return command; |
17 | 22 | ||
... | ... | ||
20 | else | 25 | else |
21 | return command + " or "; | 26 | return command + " or "; |
22 | } | 27 | } |
28 | |||
29 | public string BuildCommandRange<T>(Range<T> comparator, bool isLast) where T : IComparable | ||
30 | { | ||
31 | string command = String.Format("({0} >= {1} and {0} <= {2})", comparator.NameProperty, comparator.MinValue.ToString(),
comparator.MaxValue.ToString()); | ||
32 | |||
33 | if (isLast) | ||
34 | return command; | ||
35 | |||
36 | if (comparator.And) | ||
37 | return command + " and "; | ||
38 | else | ||
39 | return command + " or "; | ||
40 | } | ||
41 | |||
42 | |||
23 | } | 43 | } |
24 | } | 44 | } |
Download diff