예제 #1
0
        /// <summary>
        /// Gets a list of AttributeIds for the specified entityTypeId
        /// </summary>
        /// <param name="entityTypeId">The entity type identifier.</param>
        /// <returns></returns>
        internal static List <EntityAttributes> GetByEntity(int?entityTypeId)
        {
            var allEntityAttributes = EntityAttributesCache.Get();

            if (allEntityAttributes != null)
            {
                List <EntityAttributes> result;
                if (entityTypeId.HasValue)
                {
                    result = allEntityAttributes.EntityAttributesByEntityTypeId.GetValueOrNull(entityTypeId.Value) ?? new List <EntityAttributes>();
                }
                else
                {
                    result = allEntityAttributes.EntityAttributes.Where(a => !a.EntityTypeId.HasValue).ToList();
                }

                return(result);
            }

            return(new List <EntityAttributes>());
        }
예제 #2
0
 /// <summary>
 /// Updates the <see cref="EntityAttributesCache" /> based on the attribute and entityState
 /// </summary>
 /// <param name="attribute">The attribute.</param>
 /// <param name="entityState">State of the entity.</param>
 internal static void UpdateCacheEntityAttributes(Rock.Model.Attribute attribute, EntityState entityState)
 {
     EntityAttributesCache.UpdateCacheEntityAttributes(attribute, entityState);
 }
예제 #3
0
 public static void FlushEntityAttributes()
 {
     EntityAttributesCache.Remove();
 }