Convert Database first into Code first in the Abp Framework
Preface: Abp suite is known as a tool to generate Code first; however, we also want to aply this tool for Database first, so what should we do?
Use for Oracle database.
Download source: https://github.com/ngotruongblog/Generator
Step 0: Download source
Download source at : https://github.com/ngotruongblog/Generator
Step 1: Install EF Core Power Tool for visual studio
Step 2: Right-click in Generater project, choose Reverse Engineer
Step 3: Click the Add Connection icon in Server Explorer
Choose Database Connection → Choose table/view to generate
Step 4: Install oracle.entityframeworkcore nuget and delete DataContext.cs file
Step 5: Create file json
- _nameSpaceModels: namespace name of prior created entity
- _pathOutput: where contains the json files
- _nameProject: module name
Step 6: Copy json files into .suite\entities\ folder in the Abp project
Then, refresh Abp Suite tool and generate code.
Step 7: After generating code from Abp Suite, we need to edit xxxDbContextModelCreatingExtensions.cs so that the colume name could be fit with database