A simple tool to make Entity Framework scaffold output a little bit nicer
- Removes
virtual
from entity classes - Removes the connection string from the DbContext
- Moves table configurations from DbContext to configuration classes that implements
IEntityTypeConfiguration
- Changes the namespace to a specified one
Steps:
- Clone the repo
- Install dependencies with a node package manager (I suggest pnpm)
pnpm install
- Build the project
pnpm build
- See the available arguments with
pnpm start --help
This script assumes:
- That the input files uses 4 spaces tabulation
- That inside the input path is present the
DbContext
file and theEntities
folder - The
DbContext
file name ends withContext.cs
The script does not copy other files from the input to the output folder, only the DbContext
and the files inside the Entities
folder
- Make the rename of namespace optional
- Make the code less ugly
- Switch to TypeScript
- Make a npm executable (use the
bin
field ofpackage.json
as described here)