Exemplo n.º 1
0
        protected override async Task OnExecute(CommandLineApplication application)
        {
            if (!string.IsNullOrEmpty(OptionDirectoryWorking))
            {
                _options.DirectoryWorking = OptionDirectoryWorking;
            }

            if (OptionReplaceFile.HasValue)
            {
                _options.ReplaceFile = OptionReplaceFile.Value;
            }

            _csprojService.IsValidProject(_options.DirectoryWorking);

            await _mappingService.CreateMappingFiles();
        }
Exemplo n.º 2
0
        protected override async Task OnExecute(CommandLineApplication application)
        {
            if (!string.IsNullOrEmpty(OptionDirectoryWorking))
            {
                _options.DirectoryWorking = OptionDirectoryWorking;
            }

            if (OptionReplaceFile.HasValue)
            {
                _options.ReplaceFile = OptionReplaceFile.Value;
            }

            if (OptionContext.HasValue)
            {
                _options.CreateContext = OptionContext.Value;
            }

            if (OptionUnitOfWork.HasValue)
            {
                _options.CreateUnitOfWork = OptionUnitOfWork.Value;
            }

            if (OptionRepositoryBase.HasValue)
            {
                _options.CreateRepositoryBase = OptionRepositoryBase.Value;
            }

            if (OptionInitialize.HasValue)
            {
                _options.CreateInitialize = OptionInitialize.Value;
            }

            if (OptionRunAll.HasValue)
            {
                _options.RunAll = OptionRunAll.Value;
            }

            _csprojService.IsValidProject(_options.DirectoryWorking);

            if ((!_options.CreateContext &&
                 !_options.CreateUnitOfWork &&
                 !_options.CreateRepositoryBase &&
                 !_options.CreateInitialize) || _options.RunAll)
            {
                await _entityService.CreateAbstractEntity();
            }

            if (_options.RunAll)
            {
                await _mappingService.CreateMappingFiles();

                await _repositoryService.CreateRepositories();
            }

            if (_options.CreateContext || _options.RunAll)
            {
                await _contextService.CreateContextFile();
            }

            if (_options.CreateUnitOfWork || _options.RunAll)
            {
                await _unitWorkService.CreateUnitWorkFile();
            }

            if (_options.CreateRepositoryBase || _options.RunAll)
            {
                await _repositoryService.CreateRepositoryBase();
            }

            if (_options.CreateInitialize || _options.RunAll)
            {
                await _configureInjectionService.CreateConfigureInjection();
            }

            _csprojService.ExistPackageReference();
        }