0

我正在尝试更新 Product 实体并收到以下错误

"internalexception":{ "message":"模型无法解析名为“Product”的类型。当模型可用时,每个类型名称都必须解析为有效类型。","type":"System.InvalidOperationException ","stacktrace":" 在 Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataEntityDeserializer.ReadODataBody[T](HttpRequestMessage 请求)"}

我在 VS2017 中使用 OData Connected Service 生成代理类并尝试通过调用这些资源进行更新,以下是更新实体记录的代码

DataServiceCollection<Product> products = new DataServiceCollection<Product>(context.ODataResources, "Products", null, null);

       products.Add(product); //here product is the entity object that needs to be updated.

       var productTobeUpdated = products.FirstOrDefault();

       productTobeUpdated.property = value;

       context.ODataResources.UpdateObject(productTobeUpdated);

       _context.ODataResources.SaveChangesAsync(SaveChangesOptions.PostOnlySetProperties)

谁能帮我这个?

4

0 回答 0