I have model in my project. Here is code of model
public partial class Logging
{
public string Imei { get; set; }
public DateTime CurDateTime { get; set;
You are returning an anonymous type instead of Logging
. The firstitem
and lastItem
are Anonymous Types. Change your code to this:
x => new Logging
{
Longitude2 = x.Longitude2,
Latitude2 = x.Latitude2,
//And other properties
}
And if you still get error probably it is because you cannot project onto a mapped entity then you need to create a DTO class with needed properties from the Logging
entity:
public class LoggingDTO
{
public string Longitude2 { get; set; }
public string Latitude2 { get; set; }
//And other properties
}
Then:
x => new LoggingDTO