public static AspNetCoreProject CreateAspNetCoreProject(this EntityFrameworkCoreProject entityFrameworkCoreProject, string name, string outputDirectory)
        {
            var aspNetCoreProject = new AspNetCoreProject
            {
                Name                       = name,
                OutputDirectory            = outputDirectory,
                Database                   = entityFrameworkCoreProject.Database,
                EntityFrameworkCoreProject = entityFrameworkCoreProject
            };

            aspNetCoreProject.BuildFeatures();

            foreach (var selection in entityFrameworkCoreProject.Selections)
            {
                aspNetCoreProject.Selections.Add(new ProjectSelection <AspNetCoreProjectSettings>
                {
                    Pattern  = selection.Pattern,
                    Settings = new AspNetCoreProjectSettings
                    {
                        ForceOverwrite = selection.Settings.ForceOverwrite,
                        UseLogger      = true
                    }
                });
            }

            return(aspNetCoreProject);
        }
예제 #2
0
        public static AspNetCoreProject ScaffoldAspNetCore(this EntityFrameworkCoreProject entityFrameworkProject, string name, string outputDirectory, Database database)
        {
            var aspNetCoreProject = new AspNetCoreProject
            {
                Name            = name,
                OutputDirectory = outputDirectory,
                Database        = database
            };

            aspNetCoreProject.BuildFeatures();

            foreach (var selection in entityFrameworkProject.Selections)
            {
                aspNetCoreProject.Selections.Add(new ProjectSelection <AspNetCoreProjectSettings>
                {
                    Pattern  = selection.Pattern,
                    Settings = new AspNetCoreProjectSettings
                    {
                        ForceOverwrite   = selection.Settings.ForceOverwrite,
                        UseLogger        = true,
                        ConcurrencyToken = selection.Settings.ConcurrencyToken,
                        AuditEntity      = selection.Settings.AuditEntity == null ? null : new AuditEntity
                        {
                            CreationUserColumnName       = selection.Settings.AuditEntity.CreationUserColumnName,
                            CreationDateTimeColumnName   = selection.Settings.AuditEntity.CreationDateTimeColumnName,
                            LastUpdateUserColumnName     = selection.Settings.AuditEntity.LastUpdateUserColumnName,
                            LastUpdateDateTimeColumnName = selection.Settings.AuditEntity.LastUpdateDateTimeColumnName
                        },
                        EntitiesWithDataContracts = selection.Settings.EntitiesWithDataContracts
                    }
                });
            }

            aspNetCoreProject.ScaffoldResponses();
            aspNetCoreProject.ScaffoldResponsesExtensions();
            aspNetCoreProject.ScaffoldRequestModels();
            aspNetCoreProject.ScaffoldRequestModelsExtensions();
            aspNetCoreProject.ScaffoldReadMe();

            foreach (var feature in aspNetCoreProject.Features)
            {
                CSharpClassBuilder.CreateFiles(aspNetCoreProject.OutputDirectory, "Controllers", aspNetCoreProject.GlobalSelection().Settings.ForceOverwrite, feature.GetControllerClassDefinition());
            }

            return(aspNetCoreProject);
        }
        public static AspNetCoreProject CreateAspNetCoreProject(this EntityFrameworkCoreProject entityFrameworkCoreProject, string name, string outputDirectory, Database database)
        {
            var aspNetCoreProject = new AspNetCoreProject
            {
                Name                       = name,
                OutputDirectory            = outputDirectory,
                Database                   = database,
                EntityFrameworkCoreProject = entityFrameworkCoreProject
            };

            aspNetCoreProject.BuildFeatures();

            foreach (var selection in entityFrameworkCoreProject.Selections)
            {
                aspNetCoreProject.Selections.Add(new ProjectSelection <AspNetCoreProjectSettings>
                {
                    Pattern  = selection.Pattern,
                    Settings = new AspNetCoreProjectSettings
                    {
                        ForceOverwrite   = selection.Settings.ForceOverwrite,
                        UseLogger        = true,
                        ConcurrencyToken = selection.Settings.ConcurrencyToken,
                        AuditEntity      = selection.Settings.AuditEntity == null ? null : new AuditEntity
                        {
                            CreationUserColumnName       = selection.Settings.AuditEntity.CreationUserColumnName,
                            CreationDateTimeColumnName   = selection.Settings.AuditEntity.CreationDateTimeColumnName,
                            LastUpdateUserColumnName     = selection.Settings.AuditEntity.LastUpdateUserColumnName,
                            LastUpdateDateTimeColumnName = selection.Settings.AuditEntity.LastUpdateDateTimeColumnName
                        },
                        EntitiesWithDataContracts = selection.Settings.EntitiesWithDataContracts
                    }
                });
            }

            return(aspNetCoreProject);
        }