Friday, January 7, 2011

Setting the Primary Key of a Custom Entity in a Plugin

I needed to set the primary key Guid on a custom entity in the Pre stage of a Plugin.  It required adding a KeyProperty to my DynamicEntity.

 

    Guid requestId = Guid.NewGuid();

    Key newReqKey = new Key(requestId);

 

    entity.Properties.Add(new KeyProperty("new_myentityid", newReqKey));

 

No comments: