/// <summary> /// Load all channelOwners from the database. /// </summary> /// <returns></returns> private ChannelOwnerSet LoadChannelOwnerSet() { var channelOwnerSet = new ChannelOwnerSet(); // Get the collection from the ORM data layer var metaData = new LinqMetaData(); IQueryable <ChannelOwnerEntity> channelOwners = from c in metaData.ChannelOwner select c; var channelOwnerCollection = ((ILLBLGenProQuery)channelOwners).Execute <ChannelOwnerCollection>(); // Fill the entity set from the data collection if (channelOwnerCollection.Count > 0) { foreach (var channelOwnerEntity in channelOwnerCollection) { var channelnOwner = new ChannelOwner(channelOwnerEntity); channelOwnerSet.Add(channelnOwner); } } // Return the entity set return(channelOwnerSet); }
/// <summary> /// Get the collection of all channelOwners. /// </summary> /// <param name="noCache">Bypass the cache</param> /// <param name="refreshCache">Force refresh the cache</param> /// <returns>A set of channelOwners</returns> public ChannelOwnerSet GetChannelOwners(bool noCache, bool refreshCache) { // If no cache the load and return a entity set from the database if (noCache && !refreshCache) { return(LoadChannelOwnerSet()); } ChannelOwnerSet channelOwnerSet; string cacheKey = ChannelOwnerSet.StaticGetCacheKey(); if (!CacheManagerProvider.GetCacheManagerInstance().Contains <ChannelOwnerSet>(cacheKey) || refreshCache) { // Load the entity set from the database channelOwnerSet = LoadChannelOwnerSet(); if (channelOwnerSet != null) { // Add the entity set to the cache by reading caching parameters from the configuration CacheManagerProvider.GetCacheManagerInstance().Insert(cacheKey, channelOwnerSet, ConfigurationManager.GetCacheExpirationByType( channelOwnerSet.GetType())); } } else { channelOwnerSet = CacheManagerProvider.GetCacheManagerInstance().Get <ChannelOwnerSet>(cacheKey); } return(channelOwnerSet); }