dotnet / dotnet/efcore

AOT: flow IProperty information to materializer's CreateGetValueExpression for dealing with properties with non-default converters

Open
#33,517 1 comment 3 reactions 0 assignees View on GitHub
area-aot area-query consider-for-next-release
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

Currently when building property value expressions in the materializer, sometimes we must go through converter. Some of those converters capture constants "forbidden" in the AOT context. To avoid that, we use IProperty information to get the correct TypeMapping for that property, get converter from there and invoke the FromProvider delegate to get the final value.
However, if IProperty is not available, the only other way to get type mapping is from TypeMappingSource using CLR type as key. This is no reliable - multiple type mappings could be associated with the given CLR type key and we just get the default one.
What we do now is, if we don't have IProperty available, we peek into the converter FromProviderExpression and only if that captures a forbidden object we fallback to TypeMappingSource, otherwise we incorporate the lambda directly without going through TypeMapping.

Ideally we want to be consistent here, always have the right type mapping available. So we should always have IProperty when the type mapping is not the default.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.