Skip to content

Reduce EF Core application startup time via compiled models #1906

@mikary

Description

@mikary

This an "epic" issue for the theme of generating a compiled model with fast loading and access times. Specific pieces of work will be tracked by linked issues.

Proposed for 6.0

Used by calling new tool commands (all parameters are optional)

dotnet ef dbcontext optimize -c MyContext -o MyFolder -n My.Namespace
Optimize-DbContext -Context MyContext -OutputDir MyFolder -Namespace My.Namespace
  • Add runtime annotation support to model Add runtime annotation support to model #22031
  • Convert metadata extension methods to default interface implementations. Convert metadata extension methods to default interface implementations. #19213
  • Create a read-optimized implementation of IModel that can be used as the base for the compiled model Create a read-optimized implementation of IModel #8258
  • Add API to set custom implementation types instead of objects
    • ValueGenerator (store non-lambda configuration separately)
    • ValueComparer and ValueConverter
  • Implement a generator that outputs the source code for a custom model implementation
    • Throw when the model contains non-serializable configuration like lambdas, proxy types and non-serializable expressions. Or if it's using a read-optimized implementation.
    • Generate #nullable enable
    • Warn when using a model generated by an older version.
    • Warn when using a non-default model cache key.

Backlog

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions