문제

In this article, the author mentioned the following: Also we were reading post image and updating the post image as it is. This was also creating a problem. Please create a new object of Entity and then set only those fields which you want to update. Then update the record.

How to create a new object of PostImage Entity?

도움이 되었습니까?

해결책

PostImage, PreImage and Target all translate to Entity.

e.g.

Entity myEntity = new Entity("new_entityname");
myEntity["attriubteName"] = "String Data";
Guid returnId = service.Create(myEntity);

The author of the article above suggested that in order to avoid his issues you should not edit and update the context.PostEntityImage["PostImageKey"] directly but map the attributes you want to update to a new Entity like so

//context post image Entity
Entity postMessageImage = (Entity)context.PostEntityImages["PostImage"];
//new Entity 
Entity myEntity = new Entity("new_entityname");
//map and update
myEntity["attriubteName"] = postMessageImage["attributeName"];
myEntity["attriubteId"] = postMessageImage["attributeId"];
service.Update(myEntity);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top