/// <summary> /// Updates any Cache Objects that are associated with this entity /// </summary> /// <param name="entityState">State of the entity.</param> /// <param name="dbContext">The database context.</param> public void UpdateCache(System.Data.Entity.EntityState entityState, Rock.Data.DbContext dbContext) { AttributeCache cacheAttribute = AttributeCache.Get(this.AttributeId, dbContext as RockContext); if (cacheAttribute == null) { return; } if (this.EntityId.HasValue && cacheAttribute.EntityTypeId.HasValue) { EntityTypeCache entityType = EntityTypeCache.Get(cacheAttribute.EntityTypeId.Value, dbContext as RockContext); if (entityType?.HasEntityCache() == true) { entityType.FlushCachedItem(this.EntityId.Value); } } if ((!cacheAttribute.EntityTypeId.HasValue || cacheAttribute.EntityTypeId.Value == 0) && string.IsNullOrEmpty(cacheAttribute.EntityTypeQualifierColumn) && string.IsNullOrEmpty(cacheAttribute.EntityTypeQualifierValue)) { // Update GlobalAttributes if one of the values changed GlobalAttributesCache.Remove(); } }