dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.72k stars 3.17k forks source link

Break apart methods in the compiled model #31370

Open culushishui opened 1 year ago

culushishui commented 1 year ago

Database have about 1350 tables and 35650 fields. I uploaded compiled models library(EFCoreCompiledModels.zip),can reference it and compile,will show CS0240 error EFCoreCompiledModels.zip

EF Core version: Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer) Target framework: (e.g. .8.0.0-preview.6.23329.4) Operating system: IDE: (e.g. Visual Studio 2022 17.4)

ajcvickers commented 1 year ago

Note for triage: EFCoreStudyContextCompliedModel is 521,614 lines long.

culushishui commented 1 year ago

Think you reply. Triage is some tables in one dbcontext and other some tables in another dbconext ?

almostchristian commented 10 months ago

In EF Core 7, my compiled model file was 13,880 lines long, and turned into 453,786 after updating to EF Core 8. The new CreateRelationalModel function, which is over 430,000 lines long, seems to be the culprit, since the Initialize function seems to be similar to the one in EF Core 7.

AndriySvyryd commented 10 months ago

As a workaround you can remove the CreateRelationalModel method. EF will then fallback to 7.0 behavior and create it at runtime.

ajcvickers commented 10 months ago

@AndriySvyryd We should doc this workaround in the breaking changes.

ajcvickers commented 9 months ago

Doc'ed in https://github.com/dotnet/EntityFramework.Docs/pull/4593