You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using this with Entity Framework 8 (and sql server), OrderBy does not work when an entity property is a mapped column.
Example entity:
[Table("Invoices")]publicpartialclassInvoice{publicintId{get;set;}[Column("DatePaid")]// property is mapped to the column "DatePaid" in the databasepublicDateTime?PaymentDate{get;set;}}
Then running OrderBy:
varinvoices=context.Invoices;varconfig=newParsingConfig(){// this is the default value, but setting it explicitly here for clarityRestrictOrderByToPropertyOrField=true};varorderedQuery=invoices.OrderBy(config,"x => x.PaymentDate == null ? 1 : 2");
Expected result: Using the default configuration, I would expect the property to be parsed and mapped correctly.
Actual result: This results in a ParseException with message: No property or field 'null' exists in type 'Invoice'
When setting RestrictOrderByToPropertyOrField to false, it works.