Allow stripping away all model building code to reduce application size #29755
Labels
area-aot
area-model-building
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-enhancement
Milestone
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.
The text was updated successfully, but these errors were encountered: