How adding items to list

后端 未结 1 1044
青春惊慌失措
青春惊慌失措 2021-01-23 07:46

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;         


        
相关标签:
1条回答
  • 2021-01-23 08:35

    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
    
    0 讨论(0)
提交回复
热议问题