efcore: Query: NotSupportedException while trying to use EF.Property
While working on array property support for Npgsql (#9183), I ran across an exception while trying to access an entity’s array property via EF.Property
. Accessing the same property in the regular, strongly-typed way worked just fine. I’m not sure to what extent this problem is specific to the fact that the property is an array, the exception message seems to suggest otherwise.
The failing test is Length_on_EF_Property, compare to Length. The exception is:
System.NotSupportedException : Cannot parse expression 'e' as it has an unsupported type. Only query sources (that is, expressions that implement IEnumerable) and query operators can be parsed.
---- System.ArgumentException : Parameter 'expression.Type' is a 'Microsoft.EntityFrameworkCore.Query.SomeEntity', which cannot be assigned to type 'System.Collections.IEnumerable'.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 23 (23 by maintainers)
Confirmed, this passes with the new query pipeline! Yay!
Note that this is definitely not the most high-priority issue, even for PostgreSQL support. Array types are probably not very widely used, and shadow property access is probably even more rare.