Skip to content

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

@maumar

Description

@maumar

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.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions