Skip to content

Allow stripping away all model building code to reduce application size #29755

@roji

Description

@roji

Since users can support precompiled models, model building code shouldn't be needed in runtime, and we can get rid of it to reduce application size. This is especially important for AOT, but isn't necessarily coupled to it.

EF invokes model building implicitly, i.e. there's no explicit gesture for building a model. This unfortunately means that normal trimming cannot detect that model building isn't being used in the application - unless we change EF's API and introduce a breaking change around this (e.g. a new API to trigger model building, without which implicit model building doesn't occur).

We can instead use a feature switch to allow users to opt into stripping the model building code. This feature switch could be activated automatically when publishing to AOT.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions