コード例 #1
0
        private static void Main()
        {
            ServiceProvider sp = Container.Build();

            IFilesService      filesService      = sp.GetService <IFilesService>();
            IUserAccessService userAccessService = sp.GetService <IUserAccessService>();
            IUserConsoleInputViewModelToNewFileDtoAdapter adapterViewModelToNewFileDto = sp.GetService <IUserConsoleInputViewModelToNewFileDtoAdapter>();

            try
            {
                Console.WriteLine(" ######## Welcome to File Reader ######## ");
                Console.WriteLine(" ######################################## ");
                Console.WriteLine(Environment.NewLine);

                UserConsoleInputViewModel viewModel = new UserConsoleInputViewModel();

                ReadInputOption <UserOperationType>(viewModel.Operation, "operation", UserAccess.AvailableUserOperations());
                ReadInputOption <UserAccessOperationType>(viewModel.AccessOperation, "access operation", UserAccess.AvailableUserAccessOperations());

                ReadUserInputs(viewModel);

                NewFileDto dto = adapterViewModelToNewFileDto.Adapt(viewModel);

                string fileContent = filesService.ReadNewFile(dto);

                Console.WriteLine(fileContent);
                Console.ReadKey();
            }
            finally
            {
                sp.Dispose();
            }
        }