Compiled models —— .NET Core 6.0

官方文档:

https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-6.0/whatsnew#compiled-models

 

优势:

  • improve EF Core startup time for applications with large models.
    • Startup time means the time to perform the first operation on a DbContext when that DbContext type is used for the first time in the application. Note that just creating a DbContext instance does not cause the EF model to be initialized. Instead, typical first operations that cause the model to be initialized include calling DbContext.Add or executing the first query.
    • A large model typically means 100s to 1000s of entity types and relationships.
  • Compiled models are created using the dotnet ef command-line tool. Ensure that you have installed the latest version of the tool before continuing.
  • The --output-dir and --namespace options can be used to specify the directory and namespace into which the compiled model will be generated.
    • The output from running this command includes a piece of code to copy-and-paste into your DbContext configuration to cause EF Core to use the compiled model.
  • multiple compiled models can be generated for DbContext types that may use different models depending on some runtime configuration
  • Compiled models have some limitations:

  • Compiled models —— .NET Core 6.0

     

     

上一篇:ubuntu内核降版本


下一篇:Vscode 编写并运行C程序