Rock.Model.AttributeService.GetSystemSettings C# (CSharp) Method

GetSystemSettings() public method

Returns a queryable collection containing the Global Attributes.
public GetSystemSettings ( ) : IQueryable
return IQueryable
        public IQueryable<Attribute> GetSystemSettings()
        {
            return this.Get( null, Attribute.SYSTEM_SETTING_QUALIFIER, string.Empty );
        }

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Returns Global Attributes from cache.  If they are not already in cache, they
        /// will be read and added to cache
        /// </summary>
        /// <returns></returns>
        private static SystemSettings Read()
        {
            string cacheKey = SystemSettings.CacheKey();

            RockMemoryCache cache          = RockMemoryCache.Default;
            SystemSettings  systemSettings = cache[cacheKey] as SystemSettings;

            if (systemSettings != null)
            {
                return(systemSettings);
            }
            else
            {
                systemSettings            = new SystemSettings();
                systemSettings.Attributes = new List <AttributeCache>();

                var rockContext      = new RockContext();
                var attributeService = new Rock.Model.AttributeService(rockContext);

                foreach (Rock.Model.Attribute attribute in attributeService.GetSystemSettings())
                {
                    var attributeCache = AttributeCache.Read(attribute);
                    systemSettings.Attributes.Add(attributeCache);
                }

                cache.Set(cacheKey, systemSettings, new CacheItemPolicy());

                return(systemSettings);
            }
        }
All Usage Examples Of Rock.Model.AttributeService::GetSystemSettings