Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# web api返回未序列化的复杂对象_C#_Linq_Asp.net Web Api2 - Fatal编程技术网

C# web api返回未序列化的复杂对象

C# web api返回未序列化的复杂对象,c#,linq,asp.net-web-api2,C#,Linq,Asp.net Web Api2,我正在尝试使用Linq.Dynamic includes返回一个复杂对象,当我要从WebAPI返回它时,我看到的是格式良好的对象,但当我在响应中看到它时,我没有看到我假装发送的列表 return await context.Customers .Include(c => c.ListOfPhones).FirstOrDefault(c => c.customerId == customerId); 有人能帮我吗?如果有人经历过这种情况,修复非常简单,我刚刚意

我正在尝试使用Linq.Dynamic includes返回一个复杂对象,当我要从WebAPI返回它时,我看到的是格式良好的对象,但当我在响应中看到它时,我没有看到我假装发送的列表

return await context.Customers
            .Include(c => c.ListOfPhones).FirstOrDefault(c => c.customerId == customerId);

有人能帮我吗?

如果有人经历过这种情况,修复非常简单,我刚刚意识到我在课堂上忘记了[DataMember]

[DataMember]
公共虚拟ICollection列表电话{get;set;}