C# 使用simple.odata.client更新动态属性

C# 使用simple.odata.client更新动态属性,c#,odata,simple.odata,C#,Odata,Simple.odata,我在服务器中有以下类 namespace ServerNameSpace.Models { public class Product { [Key] public int Id { get; set; } [Key] public string Name { get; set; } public IDictionary<string, object> DynamicProperties {get; set;}

我在服务器中有以下类

namespace ServerNameSpace.Models
{
    public class Product
    {
      [Key]
      public int Id { get; set; }
      [Key]
      public string Name { get; set; }
      public IDictionary<string, object> DynamicProperties {get; set;} 
   }
}
namespace-ServerNameSpace.Models
{
公共类产品
{
[关键]
公共int Id{get;set;}
[关键]
公共字符串名称{get;set;}
公共IDictionary动态属性{get;set;}
}
}
我正试图从客户端更新上述类的动态属性。在下面的示例中,“制造商”是驻留在服务器中的动态属性。什么时候 我尝试使用以下代码更新它,但收到错误类型“ServerNameSpace.Models.Product”上不存在属性“Manufacturer”。确保仅使用由客户端中的类型定义的属性名称。我在fiddler中看不到对服务器的任何请求

static async void test()
{
    ODataClient client = new ODataClient("http://localhost.fiddler:58460/");
    Dictionary<string, object> keys = new Dictionary<string, object>()
    {
            {"Id", 123},
            {"Name", "ABC"}
    };
    await client.For("Products").Key(keys).Set(new Dictionary<string,object>()
            {
                {"Manufacturer","Me"}
            }).UpdateEntryAsync();
}
静态异步无效测试()
{
ODataClient=新的ODataClient(“http://localhost.fiddler:58460/");
字典键=新字典()
{
{“Id”,123},
{“姓名”,“ABC”}
};
等待client.For(“产品”).Key(Key).Set(新字典()
{
{“制造商”、“我”}
}).UpdateEntryAsync();
}

如何更新具有动态属性的对象的属性?。任何帮助都将不胜感激。

请看我对类似问题的回答,这里有一个指向处理开放属性的示例代码的链接


看看我对一个类似问题的回答,这里有一个指向处理打开属性的示例代码的链接