Closed AhmedMSedeek closed 7 months ago
Hi @AhmedMSedeek, and thanks for posting this. Under the hood, this library builds on top of the FromSqlRaw
API; therefore I'm afraid there's little—if anything—I can do about this scenario.
Have you confirmed that this is genuinely supported by EF? For instance, could you please try to reproduce this issue by consuming the values from your properties
list directly from another entity in your DbContext
? Does that work, or do you still get the same error?
Specifically, I'd like to know if the case where you dynamically specify the second parameter to EF.Property
can be natively handled by EF.
Hello @yv989c, thank you a lot for your effort and interest,
We tried you scenario by creating a table in the database that has only one varchar column with properties names list, and joining this table and calling the EF.Property
with the value from this column did throw the same error, so the error is apparently related to Entity Framework core itself and not related to QueryableValues,
Thanks a lot again, I'll create an issue on Entity Framework repo itself and see if they can resolve it!
EF.Property throws exception with list used in AsQueryableValues() extension,
Details: EF Core Version: 8.0.1 Database Engine: SQL Server Exception: "The EF.Property method may only be used within Entity Framework LINQ queries"
Note: Reverse engineering "scaffolding" was used to automatically generate the dbcontext
There're some cases where we cannot read properties directly and we need to use EF.Property instead, this extension does not work with AsQueryableValues list and throws the exception, I understand this exception is normally raised when client evaluation happens instead of server evaluation, so maybe when we use EF.Property along with AsQueryableValues it forces client evaluation for some reason, example with temporal tables below:
Edit #1: Fixed Typo