我有一个动态的ExpandoObject结果,其中包含以下键值对:
{ id: "1" }
{ product_name: "some name" }
{ product_category: "some category" }
我有一堂课:
public class Product
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("productName")]
public string ProductName { get; set; }
[JsonProperty("productCategory")]
public string ProductCategory { get; set; }
}
那么我可以将ExpandoObject作为新对象映射到此类吗? (ExpandoObject属性来自数据库列。)