Esempio n. 1
0
        public async System.Threading.Tasks.Task Run()
        {
            // root file path
            var rootFilePath = "src/SDK/Foundation";

            var entities = Config["entities"];

            EntityFactoryGenerator.GenerateEntityFactory(entities, rootFilePath, CompilationContainer);

            // generate entities
            foreach (var entity in entities)
            {
                var entityGroup      = entity["group_id"].GetStringValue().ToPascal();
                var entityNamePascal = entity["_key"].GetStringValue().ToPascal();

                // generate entity enums
                EnumGenerator.GenerateEnums(entity, rootFilePath, entityGroup, entityNamePascal, CompilationContainer);

                // generate entity class
                EntityClassGenerator.GenerateEntityClass(entity, entityNamePascal, rootFilePath, entityGroup, CompilationContainer);

                if (entity["methods"].Any())
                {
                    EntityRepositoryGenerator.GenerateRepository(entity, entityNamePascal, rootFilePath, entityGroup, CompilationContainer);
                }
            }

            await CompilationContainer.Compile();

            CompilationContainer.WriteFiles();
        }