public Assembly Build(ODatalizerEndpoint ep)
        {
            var generator = ControllerGenerator.Create(ep);
            var code      = generator.TransformText();

            _logger.LogDebug(ODatalizerLogEvents.ControllerCodeGenerated, code);
            return(Build(code, generator.Namespace));
        }
Example #2
0
 public static Contracts.IControllerGenerator GetControllerGenerator(string solutionName, string contractsFilePath)
 {
     return(ControllerGenerator.Create(SolutionProperties.Create(solutionName, contractsFilePath)));
 }
Example #3
0
        static void Main(string[] args)
        {
            SolutionProperties   solutionProperties   = SolutionProperties.Create();
            EntityGenerator      entityGenerator      = EntityGenerator.Create(solutionProperties);
            DataContextGenerator dataContextGenerator = DataContextGenerator.Create(solutionProperties);
            ControllerGenerator  controllerGenerator  = ControllerGenerator.Create(solutionProperties);
            FactoryGenerator     factoryGenerator     = FactoryGenerator.Create(solutionProperties);
            TransferGenerator    transferGenerator    = TransferGenerator.Create(solutionProperties);

            List <string> lines = new List <string>();

            Console.WriteLine("Create Modules-Entities...");
            lines.Clear();
            lines.AddRange(entityGenerator.CreateModulesEntities());
            WriteAllLines(solutionProperties.EntitiesModulesFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Business-Entities...");
            lines.Clear();
            lines.AddRange(entityGenerator.CreateBusinesssEntities());
            WriteAllLines(solutionProperties.EntitiesBusinessFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Persistence-Entities...");
            lines.Clear();
            lines.AddRange(entityGenerator.CreatePersistenceEntities());
            WriteAllLines(solutionProperties.EntitiesPersistenceFilePath, FormatCSharp(lines));

            Console.WriteLine("Create DataContext-DbContext...");
            lines.Clear();
            lines.AddRange(dataContextGenerator.CreateDbContext());
            WriteAllLines(solutionProperties.DataContextPersistenceFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Persistence-Controllers...");
            lines.Clear();
            lines.AddRange(controllerGenerator.CreatePersistenceControllers());
            WriteAllLines(solutionProperties.ControllersPersistenceFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Business-Controllers...");
            lines.Clear();
            lines.AddRange(controllerGenerator.CreateBusinessControllers());
            WriteAllLines(solutionProperties.ControllersBusinessFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Factory...");
            lines.Clear();
            lines.AddRange(factoryGenerator.CreateLogicFactory());
            WriteAllLines(solutionProperties.LogicFactoryFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Modules-Transfer...");
            lines.Clear();
            lines.AddRange(transferGenerator.CreateModulesTransfers());
            WriteAllLines(solutionProperties.TransferModulesFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Business-Transfer...");
            lines.Clear();
            lines.AddRange(transferGenerator.CreateBusinessTransfers());
            WriteAllLines(solutionProperties.TransferBusinessFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Persistence-Transfer...");
            lines.Clear();
            lines.AddRange(transferGenerator.CreatePersistenceTransfers());
            WriteAllLines(solutionProperties.TransferPersistenceFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Controllers-WebApi...");
            lines.Clear();
            lines.AddRange(controllerGenerator.CreateWebApiControllers());
            WriteAllLines(solutionProperties.WebApiControllersFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Adapters...");
            lines.Clear();
            lines.AddRange(factoryGenerator.CreateAdapterFactory());
            WriteAllLines(solutionProperties.AdaptersFactoryFilePath, FormatCSharp(lines));
        }