public BookDbApplicationService(IBookLibraryRepository bookLibraryRepository, IBookDataIndexer bookIndexer, IBookDirectory directory, Func<BookSearchService> searchServiceFactory, BookFormatRegistrar bookFormatRegistrar) { this.bookLibraryRepository = bookLibraryRepository; this.bookIndexer = bookIndexer; this.directory = directory; this.searchServiceFactory = searchServiceFactory; this.bookFormatRegistrar = bookFormatRegistrar; }
private static BookDbApplicationService CreateBookApplicationService() { var indexPath = Path.Combine(Application.StartupPath, "Index"); var libraryFilePath = Path.Combine(Application.StartupPath, "data.txt"); var bookFormatRegistrar = new BookFormatRegistrar(); return new BookDbApplicationService(new JsonFileBookLibraryRepository(libraryFilePath), new BookDataIndexer(indexPath), new FsBookDirectory(ConfigurationManager.AppSettings["LibraryPath"], bookFormatRegistrar.GetSupportedExtensions()), () => new BookSearchService(indexPath), bookFormatRegistrar); }