예제 #1
0
        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);
        }