root/src/FmwkPoiesis.ObjectSearch/ObjectSearch.cs
| 3 | 4 | ||
|---|---|---|---|
3 | using System.Linq; | 3 | using System.Linq; |
4 | using System.Text; | 4 | using System.Text; |
5 | using System.Reflection; | 5 | using System.Reflection; |
6 | using CommonServiceLocator.WindsorAdapter; | 6 | //using CommonServiceLocator.WindsorAdapter; |
7 | using Microsoft.Practices.ServiceLocation; | 7 | //using Microsoft.Practices.ServiceLocation; |
8 | 8 | ||
9 | 9 | ||
10 | namespace Poiesis.FrameWork.ObjectSearch | 10 | namespace Poiesis.FrameWork.ObjectSearch |
... | ... | ||
15 | 15 | ||
16 | public class ObjectSearch : IObjectSearch | 16 | public class ObjectSearch : IObjectSearch |
17 | { | 17 | { |
18 | public static IObjectSearchProvider Provider = ServiceLocator.SetLocatorProvider(new WindsorServiceLocator()); | 18 | public static IObjectSearchProvider DefaultProvider { get; set;} |
19 | } | 19 | } |
20 | 20 | ||
21 | abstract public class ObjectSearch<T> : ObjectSearch | 21 | abstract public class ObjectSearch<T> : ObjectSearch |
... | ... | ||
27 | 27 | ||
28 | public IObjectSearchProvider GetProvider() | 28 | public IObjectSearchProvider GetProvider() |
29 | { | 29 | { |
30 | return ObjectSearch.Provider; | 30 | return ObjectSearch.DefaultProvider; |
31 | } | 31 | } |
32 | 32 | ||
33 | private List<IComparator> FindComparators() | 33 | private List<IComparator> FindComparators() |
... | ... | ||
44 | return this.Comparators; | 44 | return this.Comparators; |
45 | } | 45 | } |
46 | 46 | ||
47 | |||
48 | public string BuildCommandSearch() | 47 | public string BuildCommandSearch() |
49 | { | 48 | { |
49 | return BuildCommandSearch(ObjectSearch.DefaultProvider ); | ||
50 | } | ||
51 | |||
52 | public string BuildCommandSearch(IObjectSearchProvider provider) | ||
53 | { | ||
50 | this.Comparators = FindComparators(); | 54 | this.Comparators = FindComparators(); |
51 | int count = this.Comparators.Count; | 55 | int count = this.Comparators.Count; |
52 | 56 | ||
... | ... | ||
55 | StringBuilder sb = new StringBuilder(); | 59 | StringBuilder sb = new StringBuilder(); |
56 | for (int i = 0; i < count; i++) | 60 | for (int i = 0; i < count; i++) |
57 | { | 61 | { |
58 | sb.Append(Comparators[i].BuildCommandSearch(i == (count - 1))); | 62 | sb.Append(Comparators[i].BuildCommandSearch( provider, i == (count - 1))); |
59 | } | 63 | } |
60 | return sb.ToString(); | 64 | return sb.ToString(); |
61 | } | 65 | } |
Download diff