i have a mapped-class like this:
[Table(\"MyTable\")]
class MyClass
{
//properties; id, name, etc...
private string _queuedToWHTime
You cannot query with EF on custom properties. The custom property cannot be translated in SQL.
You can do this to force the orderby to be done 'in-memory'.
var searchRslt = queryableNews
.AsEnumerable()
.OrderBy(m => m.QueuedToWHTime_DateTime)
.ToList();
The issue is here:
var searchRslt=(from m in queryableNews
orderby m.QueuedToWHTime_DateTime descending
select m).ToList();
you are trying to use the property .QueuedToWHTime_DateTime
, but that does not exist in the database. You need to use the names that are used in the database. In this case .QueuedToWHTime
So:
var searchRslt=(from m in queryableNews
orderby m.QueuedToWHTime descending
select m).ToList();
If the database propery is not usable in this scenario, you will have to pull the entire list, convert it to an IEnumerable (any will do), then filter/order that IEnumerable by its property.
Something like this:
var result = queryableNews.ToList().OrderbyDescending(x=>x.QueuedToWHTime_DateTime).ToList();