/// <summary> /// Create a Resource object based on the ethos entity /// </summary> /// <param name="entity"></param> public EthosResource(EthosEntityBase entity) { if (entity != null) { this.Name = entity.ResourcePluralName; this.Id = entity.Id.ToString(); this.Version = entity.HeaderContentType; } }
/// <summary> /// Helper constructor populates properties based on ethos entity object, assuming resource-representation contentType. /// </summary> /// <param name="ethosEntity">Model representation of ethos entity</param> /// <param name="operation">Operation that was performed in CRM</param> public ChangeNotificationV2(EthosEntityBase ethosEntity, string operation) { Resource = new ChangeNotificationV2.EthosResource(ethosEntity); ID = -1; //cannot be null, but does not matter on publish Operation = operation; if (operation.Equals(DeletedOperation)) { ContentType = EmptyContentType; Content = new JObject(); } else { Content = JObject.Parse(JsonConvert.SerializeObject(ethosEntity)); ContentType = ResourceRepresentationContentType; } }
/// <summary> /// Helper constructor populates properties based on ethos entity object, assuming resource-representation contentType. /// </summary> /// <param name="ethosEntity">Model representation of ethos entity</param> /// <param name="operation">Operation that was performed in CRM</param> public ChangeNotificationV2(EthosEntityBase ethosEntity, ChangeOperation operation) : this(ethosEntity, GetAction(operation)) { }