- The using statement for contextNamespace had two semicolons at the end of line.
- The modelBuilder not capture all lambda.
- 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').
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.
-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.
DbContextOnModelCreatingSplitter -c Data\MyContext.cs -o Data\Configurations -n MyNamespace.Data.Configurations
A backup of the original DbContext file is created by default.