Massive with WCF Web Api to return dynamic types/Expandos?

我是研究僧i 提交于 2019-12-06 07:30:15

I think you are taking Expando Query and passing to WCF. Just try to do iteration or just give ToList to your collection. That will convert ExpandoQuery to Expando Object Collection. And if you are POCO to map, as Customer is there like in your question. Give a Select with your POCO objects.

Like if your query is

Dynamic CustomerTable = DynamicObject("ConnectionString","TableName","PrimeryKey");

CustomerTable.All() //This will be ExpandoQuery

CustomerTable.All().Select(c=> new Customer () {FistName = c.FirstName, LastName = c.LastName}); // This will give collection of customer object. Just pass this as DTO to your WCF service.

I hope this will help you. Let me know if anything further is there.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!