public async Task OnExecuteNewRepositoryCommandAsync()
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            IRepositoryGenerator repositoryGenerator = MefComponents.GetRepositoryGenerator();

            var infra        = RepositoryGeneratorParametersFactory.Create();
            var window       = infra.View;
            var dialogResult = window.ShowModal();

            if (dialogResult == true)
            {
                var model = infra.ViewModel;

                await repositoryGenerator.CreateRepositoryAsync(model, new CancellationToken());
            }
        }
예제 #2
0
        public void Generate(List<Table> tables, Configuration config, IRepositoryGenerator repoGenerator)
        {
            if (config.GenerateClasses)
            {
                var entityGenerator = new EntityGenerator(config, repoGenerator);
                tables.ForEach(m => entityGenerator.Generate(m));
            }

            if (config.GenerateControllers)
            {
                var controllerGenerator = new ControllerGenerator(config);
                tables.ForEach(m =>
                {
                    var pkColumn = m.Columns.FirstOrDefault(x => x.IsPrimaryKey);
                    string idType = (pkColumn == null) ? "int" : pkColumn.Type;
                    controllerGenerator.Generate(m.Name.UppercaseFirst(), idType);
                });
            }
        }
예제 #3
0
 public EntityGenerator(Configuration config, IRepositoryGenerator repoGenerator)
 {
     _config = config;
     _repositoryGenerator = repoGenerator;
 }
예제 #4
0
 public RepositoryScaffolder(ScaffolderDependencies dependencies, IRepositoryGenerator generator) : base(dependencies)
 {
     Generator = generator;
 }