Exemplo n.º 1
0
        public ProductSearchManager(ProductManager productManager, ISearchIndexInfoProvider searchIndexInfoProvider, ISearchProviderFactory <Product> searchProviderFactory)
        {
            this.productManager          = productManager;
            this.searchIndexInfoProvider = searchIndexInfoProvider;
            this.searchProviderFactory   = searchProviderFactory;

            searchProvider = new Lazy <ISearchProvider <Product> >(() =>
            {
                var searchIndexInfo = searchIndexInfoProvider.GetCurrentSearchIndexInfo();

                if (searchIndexInfo == null)
                {
                    throw new InvalidOperationException("Cant get current search index info");
                }

                return(searchProviderFactory.GetProvider(searchIndexInfo.IndexFilesLocation));
            });
        }
 public SearchIndexInfo GetCurrentSearchIndexInfo()
 {
     return(searchIndexInfoProvider.GetCurrentSearchIndexInfo());
 }