Example #1
0
        public static void Create(CustomTable t)
        {
            DtoBuilder builder = new DtoBuilder(t);

            string EntityFile = FileManager.ReadingTextFile(AppDomain.CurrentDomain.BaseDirectory + "Resources/Classes/Dto.cs");

            string genEntityFile = builder.Prepare(EntityFile);

            FileManager.SaveFile(".cs", builder.CurrentTable.PathOfDtoClass, genEntityFile);
        }
        public static void Build(Database _dbObject)
        {
            //------------------------------------------------------
            _NameSpace = Globals.GetProgramatlyName(_dbObject.Name);
            //------------------------------------------------------
            _ProjectFolder = AppDomain.CurrentDomain.BaseDirectory + _NameSpace;
            if (Directory.Exists(_ProjectFolder))
            {
                Directory.Delete(_ProjectFolder, true);
            }
            Directory.CreateDirectory(_ProjectFolder);
            Directory.CreateDirectory(_ProjectFolder + @"\db\");
            Directory.CreateDirectory(_ProjectFolder + @"\Controllers\");
            Directory.CreateDirectory(_ProjectFolder + @"\Models\");
            Directory.CreateDirectory(_ProjectFolder + @"\Services\");
            Directory.CreateDirectory(_ProjectFolder + @"\Repositories\");
            Directory.CreateDirectory(_ProjectFolder + @"\Views\");
            //------------------------------------------------------
            db = new CustomDatabase(_dbObject);

            foreach (CustomTable table in db.Tables)
            {
                DtoBuilder.Create(table);//first one because it reads additional meta data and set them into custom table object
                ModelBuilder.Create(table);
                StoredProcedureBuilder.Create(table);
                Directory.CreateDirectory(_ProjectFolder + @"\Models\" + table.ProgramatlyName);
                RepositoryBuilder.Create(table);
                ApplicationServiceBuilder.Create(table);
                ControllerBuilder.Create(table);
                Directory.CreateDirectory(_ProjectFolder + @"\Views\" + table.ProgramatlyName);
                IndexViewBuilder.Create(table);
                DialogBoxViewBuilder.Create(table);
            }
            Directory.CreateDirectory(_ProjectFolder + @"\Views\Shared\");
            Directory.CreateDirectory(_ProjectFolder + @"\Views\Home\");
            NavigationLinksBuilder.Create(db);
        }