EFCorePowerTools: DbContextSplitting stopped working in version 2.5.1378 (April 20, 2023)

First, thank you for a fantastic tool!

We have been using EF Core Power Tools in our Database First project for some time now, and up to and including version 2.5.1338 it was working as expected, but after installing version 2.5.1378 (and it continued to be broken in 2.5.1429), the OnModelCreating()-method in our DbContext-class stopped having lines of

modelBuilder.ApplyConfiguration(new Configurations.MyEntityConfiguration());

and instead had all the code from the configurations instead.

None of the settings in efpt.config.json have been changed, and it still contains

"UseDbContextSplitting": true,

Our project uses EF Core 6 in a .NET 6 ASP NET Core project, and our database is SQL Server. We use Visual Studio 2022.

We are not using Handlebars, T4 or dacpac.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 25 (15 by maintainers)

Most upvoted comments

Hooray - I am finally able to repro with .1429 extension also for EF Core 6.

I was trying to make a minimal repro, and I discovered that the bug only occurred when I included one specific table. In particular, if I add the following two tables (Element and Relation), it breaks. But if I only include one of them (either one) it is ok:

CREATE DATABASE ReproSplitContextDB;
USE ReproSplitContextDB

CREATE TABLE Element (
    id VARCHAR(50) NOT NULL,
    title VARCHAR(50) NOT NULL,
    CONSTRAINT PK_Element PRIMARY KEY (id)
)

CREATE TABLE Relation (
    parentId VARCHAR(50) NOT NULL,
    childId VARCHAR(50) NOT NULL,
    CONSTRAINT PK_Relation PRIMARY KEY (parentId, childId),
    CONSTRAINT FK_Relation_Element_child FOREIGN KEY (childId) REFERENCES Element (id),
    CONSTRAINT FK_Relation_Element_parent FOREIGN KEY (parentId) REFERENCES Element (id)
)