예제 #1
0
        private void InsertFile(string projectName, string templateName, string className, Dictionary <string, string> parameters)
        {
            Console.WriteLine("Inserting " + className);

            var project = solution.Projects.FirstOrDefault(x => x.Name == projectName);

            if (project == null)
            {
                return;
            }

            string template = Path.Combine(templatesFolder, templateName);

            string content = TemplateEngine.GetEngine().ProcessTemplate(template, parameters);

            Document newDocument       = project.AddDocument(className, content);
            Document formattedDocument = Formatter.FormatAsync(newDocument).Result;

            solution = formattedDocument.Project.Solution;
        }
예제 #2
0
        private void TransformInfrastructureProject()
        {
            Console.WriteLine("Transforming Infrastructure project");

            var project = solution.Projects.FirstOrDefault(x => x.Name == configuration.InfrastructureProjectName);

            if (project == null)
            {
                return;
            }

            string template   = Path.Combine(templatesFolder, Templates.TenantAwareAttributeTemplate);
            var    parameters = new Dictionary <string, string>()
            {
                { "Namespace", project.AssemblyName }
            };

            string content = TemplateEngine.GetEngine().ProcessTemplate(template, parameters);

            Document newDocument       = project.AddDocument(ClassNames.TenantAwareAttributeClassName, content);
            Document formattedDocument = Formatter.FormatAsync(newDocument).Result;

            solution = formattedDocument.Project.Solution;
        }