Пример #1
0
        public static void Create(CustomTable t)
        {
            ApplicationServiceBuilder builder = new ApplicationServiceBuilder(t);

            string fileCode      = FileManager.ReadingTextFile(AppDomain.CurrentDomain.BaseDirectory + "Resources/Classes/Service.cs");
            string generatedCode = builder.GenerateAllCode();
            string tempCode      = fileCode.Replace("$code$", generatedCode);
            string finalCode     = builder.Prepare(tempCode);

            FileManager.SaveFile(".cs", builder.CurrentTable.PathOfApplicatioServiceFile, finalCode);
        }
        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);
        }