예제 #1
0
        public void AddEntityCore(IDomainAdditionOptions options, string domainFolder, string templateFilePath, string templateFileName)
        {
            string fileData = GetFileData(options, templateFilePath);
            string filePath = GetFilePath(options, domainFolder, templateFileName);

            TypescriptClassWriter.Write(filePath, fileData);
        }
        public void Add(IDomainAdditionOptions options)
        {
            string filePath = this.pathService.GetAbsolutePathForFrontendAppRouting(options);
            string fileData = UpdateFileData(options, filePath);

            TypescriptClassWriter.Write(filePath, fileData);
        }
        public void Add(IDomainAdditionOptions options)
        {
            string filePath = GetFilePath(options);
            string fileData = UpdateFileData(options, filePath);

            File.WriteAllText(filePath, fileData);
        }
        private string GetFilePath(IDomainAdditionOptions options)
        {
            string fileName = options.DbProjectName + ".sqlproj";
            string filePath = Path.Combine(options.DbDestinationFolder, fileName);

            return(filePath);
        }
예제 #5
0
        public string GetAbsolutePathForDbDomain(IDomainAdditionOptions options, string domainFolder)
        {
            string relativePath          = domainFolder.Replace("{Domain}", options.Domain);
            string absolutePathForDomain = Path.Combine(options.DbDestinationFolder, relativePath);

            return(absolutePathForDomain);
        }
        public void UpdateDependencyProvider(IDomainAdditionOptions options, string projectFolder, string fileName)
        {
            string filePath = GetFilePath(options, projectFolder, fileName);
            string fileData = UpdateFileData(options, filePath, projectFolder);

            CsharpClassWriter.Write(filePath, fileData);
        }
예제 #7
0
        private string GetFilePath(IDomainAdditionOptions options, string domainFolder, string templateFileName)
        {
            string absolutePathForDomain = this.pathService.GetAbsolutePathForFrontendModel(options, domainFolder);
            string fileName = templateFileName.Replace("domain-kebab", StringConverter.PascalToKebabCase(options.Domain));
            string filePath = Path.Combine(absolutePathForDomain, fileName);

            return(filePath);
        }
 private string GetAppRoutingLine(IDomainAdditionOptions options)
 {
     return
         ("  {\n" +
          $"    path: '{options.Domain.ToKebab()}',\n" +
          $"    loadChildren: () => import('./pages/{options.Domain.ToKebab()}/{options.Domain.ToKebab()}-pages.module').then(m => m.{options.Domain}PagesModule)\n" +
          "  },");
 }
예제 #9
0
        public string GetAbsolutePathForFrontendModel(IDomainAdditionOptions options, string domainFolder)
        {
            string relativePath = domainFolder;

            relativePath = relativePath.Replace("{domain-kebab}", StringConverter.PascalToKebabCase(options.Domain));
            string absolutePathForDomain = Path.Combine(options.FrontendDestinationFolder, relativePath);

            return(absolutePathForDomain);
        }
예제 #10
0
        private string UpdateFileData(IDomainAdditionOptions options, string filePath, string projectFolder)
        {
            string fileData = File.ReadAllText(filePath);

            fileData = AddStartupMethod(fileData, options, projectFolder);
            fileData = AddGetStartupMethodCall(fileData, options);

            return(fileData);
        }
예제 #11
0
        public void AddDbDomainFolder(IDomainAdditionOptions options, string domainFolder)
        {
            string absolutePathForDbDomain = GetAbsolutePathForDbDomain(options, domainFolder);

            if (!Directory.Exists(absolutePathForDbDomain))
            {
                Directory.CreateDirectory(absolutePathForDbDomain);
            }
        }
예제 #12
0
        private string GetFileData(IDomainAdditionOptions options, string templateFilePath)
        {
            string fileData = File.ReadAllText(templateFilePath);

            fileData = fileData.Replace("ProjectName", options.ProjectName);
            fileData = fileData.Replace("domain-kebab", StringConverter.PascalToKebabCase(options.Domain));
            fileData = fileData.Replace("Domain", options.Domain);

            return(fileData);
        }
예제 #13
0
 public void PerformAddDomainCommand(IDomainAdditionOptions options)
 {
     try
     {
         this.AddDomain(options);
     }
     catch (Exception e)
     {
         Console.WriteLine("Fehler bei Domain-Generierung: " + e.Message);
     }
 }
예제 #14
0
        public static bool Validate(IDomainAdditionOptions options)
        {
            if (string.IsNullOrEmpty(options.Domain) ||
                !options.Domain.IsAlpha())
            {
                return(false);
            }

            options.Domain = options.Domain.UpperFirstChar();

            return(true);
        }
예제 #15
0
        public void AddDomain(IDomainAdditionOptions options)
        {
            if (!DomainAdditionOptions.Validate(options))
            {
                throw new OptionValidationException("Die Optionen sind nicht korrekt formatiert.");
            }

            foreach (ClassGeneration classGeneration in classGenerations)
            {
                classGeneration.PerformAddDomainCommand(options);
            }
        }
예제 #16
0
 private static void AddDomain(IDomainAdditionOptions domainOptions)
 {
     try
     {
         ContractorCoreApi contractorCoreApi = new ContractorCoreApi();
         contractorCoreApi.AddDomain(domainOptions);
         Console.WriteLine($"Domain '{domainOptions.Domain}' hinzugefügt.");
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #17
0
        private string UpdateFileData(IDomainAdditionOptions options, string filePath)
        {
            string fileData = File.ReadAllText(filePath);

            StringEditor stringEditor = new StringEditor(fileData);

            // ----------- DbSet -----------
            stringEditor.NextThatContains("path: '**',");
            stringEditor.Prev();

            stringEditor.InsertLine(GetAppRoutingLine(options));

            return(stringEditor.GetText());
        }
예제 #18
0
        private string AddGetStartupMethodCall(string fileData, IDomainAdditionOptions options)
        {
            StringEditor stringEditor = new StringEditor(fileData);

            // Insert using
            string startupMethodCall = GetStartupMethodCall(options.Domain);

            stringEditor.NextThatContains("void Startup(IServiceCollection services");
            stringEditor.Next();
            stringEditor.Next(line => line.CompareTo(startupMethodCall) > 0 || line.Contains("}"));
            stringEditor.InsertLine(startupMethodCall);

            return(stringEditor.GetText());
        }
예제 #19
0
        private string AddStartupMethod(string fileData, IDomainAdditionOptions options, string projectFolder)
        {
            StringEditor stringEditor = new StringEditor(fileData);

            // Insert using
            stringEditor.MoveToEnd();
            if (!stringEditor.GetLine().Contains("}"))
            {
                stringEditor.PrevThatContains("}");
            }

            stringEditor.PrevThatContains("}");
            stringEditor.InsertLine(GetStartupMethod(options.Domain, projectFolder));

            return(stringEditor.GetText());
        }
        private string UpdateFileData(IDomainAdditionOptions options, string filePath)
        {
            string fileData = File.ReadAllText(filePath);

            string dbDomainFolderLine = GetDbDomainFolderLine(options);

            StringEditor stringEditor = new StringEditor(fileData);

            stringEditor.NextThatContains("Folder Include");
            stringEditor.Prev();
            stringEditor.Next(line => line.CompareTo(dbDomainFolderLine) > 0 || line.Contains("</ItemGroup>"));

            stringEditor.InsertLine(dbDomainFolderLine);

            return(stringEditor.GetText());
        }
 protected override void AddDomain(IDomainAdditionOptions options)
 {
 }
예제 #22
0
 protected override void AddDomain(IDomainAdditionOptions options)
 {
     this.domainDependencyProvider.UpdateDependencyProvider(options, LogicProjectGeneration.ProjectFolder, FileName);
 }
예제 #23
0
 private string GetFilePath(IDomainAdditionOptions options, string projectFolder, string fileName)
 {
     return(Path.Combine(options.BackendDestinationFolder, projectFolder, fileName));
 }
예제 #24
0
        protected override void AddDomain(IDomainAdditionOptions options)
        {
            this.pathService.AddDbDomainFolder(options, DBProjectGeneration.DomainFolder);

            this.dbProjectFileDomainAddition.Add(options);
        }
예제 #25
0
 public PropertyAdditionOptions(IDomainAdditionOptions options) : base(options)
 {
 }
예제 #26
0
 protected override void AddDomain(IDomainAdditionOptions options)
 {
     this.frontendPagesDomainCoreAddition.AddEntityCore(options, PagesProjectGeneration.PagesFolder, TemplatePath, FileName);
 }
예제 #27
0
 protected abstract void AddDomain(IDomainAdditionOptions options);
 private string GetDbDomainFolderLine(IDomainAdditionOptions options)
 {
     return($"    <Folder Include=\"dbo\\Tables\\{options.Domain}\" />");
 }
예제 #29
0
 protected override void AddDomain(IDomainAdditionOptions options)
 {
     this.appRoutingDomainAddition.Add(options);
 }
예제 #30
0
 public EntityAdditionOptions(IDomainAdditionOptions options) : base(options)
 {
 }