Skip to content

Command line tool that splits FluentAPI entity definitions from DbContext.OnModelCreating() into separate configuration files.

License

Notifications You must be signed in to change notification settings

ProDInfo/DbContextOnModelCreatingSplitter

 
 

Repository files navigation

What's different about this fork:

Fixes:

  • The using statement for contextNamespace had two semicolons at the end of line.
  • The modelBuilder not capture all lambda.

News:

  • Suffix for the generated configuration files, by using the 'suffix' option at command-line ('-s').
  • Code that invokes configuration class is inserted at OnModelCreating event, but can be ignored by 'no-replace' option at command-line ('-r').
  • The configuration class can now be embedded into entity model file, by using the 'embed-config' option at command-line ('-e').

DbContext OnModelCreating Splitter

Command line tool that splits FluentAPI entity definitions from DbContext.OnModelCreating() into separate configuration files.

This tool can be used as a workaround for dotnet/efcore#8434.

Usage

  -c, --dbcontext    Required. Path the the DbContext file

  -o, --outdir       Output path for the generated configuration files

  -n, --namespace    Namespace for the generated configuration classes

  -s, --suffix       Suffix for the generated configuration files
  
  -B, --no-backup    Don't keep a copy of the original DbContext file
  
  -r, --no-replace   Don't replace OnModelCreating event code
 
  -e, --embed-config Embed EntityTypeConfiguration class into entity model file

  --help             Display this help screen.

  --version          Display version information.

Example

DbContextOnModelCreatingSplitter -c Data\MyContext.cs -o Data\Configurations -n MyNamespace.Data.Configurations

Note

A backup of the original DbContext file is created by default.

Download

You can download the binaries from the latest release.

License

MIT

About

Command line tool that splits FluentAPI entity definitions from DbContext.OnModelCreating() into separate configuration files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%