Untuk semua project, mohon pergunakan project template yang terdapat di http://rekadia.net/gitrepo/Repository/rekadia-template.
Untuk menggunakan code template generator, terlebih dahulu sudah terdapat entities yang mau dibuat. Kemudian, tekan ‘VIEWS’ –> ‘Other Window’ –> ‘Package Manager Console’. Pada window ‘Package Manager Console’, masukkan command-command berikut.
Command membuat repository:
scaffold EntitiesRepo <entity class name> -Project Business -DbContextType <DbContext hasil edmx> [-Force]
ex: scaffold EntitiesRepo m_project -Project Business -DbContextType Business.Entities.ditgas_pmoEntities
Command men-generate Model, Views, dan Controller:
scaffold ModelStub <entity class name> -Project WebUI -DbContextType <DbContext hasil edmx> [-Force]
ex: scaffold ModelStub m_project -Project WebUI -DbContextType Business.Entities.ditgas_pmoEntities
Setelah mengeksekusi command-command tersebut, maka akan terbentuk file:
- Business/Abstract/I<EntityClassName>Repository.cs
- Business/Concrete/EF<EntityClassName>Repository.cs
- WebUI/Models/<EntityClassName>/<EntityClassName>PresentationStub.cs
- WebUI/Models/<EntityClassName>/<EntityClassName>FormStub.cs
- WebUI/Controllers/<EntityClassName>Controller.cs
- WebUI/Views/<EntityClassName>/Index.cshtml
- WebUI/Views/<EntityClassName>/Form.cshtml