コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <summary>
        ///     Get the current channelOwner of a channelOwner. The cache is not bypassed by default.
        /// </summary>
        /// <param name="channelOwnerId">The channelOwner identifier</param>
        /// <param name="noCache">Bypass the cache</param>
        /// <param name="refreshCache">Force refresh the cache</param>
        /// <returns>A channelOwner</returns>
        public ChannelOwner GetChannelOwner(int channelOwnerId, bool noCache, bool refreshCache)
        {
            // If no cache the load and return a entity from the database
            if (noCache && !refreshCache)
            {
                return(LoadChannelOwner(channelOwnerId));
            }

            ChannelOwner channelOwner;

            string cacheKey = ChannelOwner.GetCacheKeyById(channelOwnerId);

            if (!CacheManagerProvider.GetCacheManagerInstance().Contains <ChannelOwner>(cacheKey) || refreshCache)
            {
                // Load the entity from the database
                channelOwner = LoadChannelOwner(channelOwnerId);

                if (channelOwner != null)
                {
                    // Add the entity to the cache by reading caching parameters from the configuration
                    CacheManagerProvider.GetCacheManagerInstance().Insert(cacheKey, channelOwner,
                                                                          ConfigurationManager.GetCacheExpirationByType(
                                                                              channelOwner.GetType()));
                }
            }
            else
            {
                channelOwner = CacheManagerProvider.GetCacheManagerInstance().Get <ChannelOwner>(cacheKey);
            }

            return(channelOwner);
        }
コード例 #3
0
        /// <summary>
        /// Create a new channelOwner object and persist it into the database.
        /// </summary>
        /// <param name="channelOwner">The channelOwner object</param>
        public ChannelOwner AddChannelOwner(ChannelOwner channelOwner)
        {
            // Persist the object into the database
            channelOwner.Save();

            // Return the new object with the new identifier (AUTO)
            return(channelOwner);
        }
コード例 #4
0
 public static Channel ChannelGetByOwner(Game game, ChannelOwner owner)
 {
     return(new Channel()
     {
         ID = (int)owner,
         Game = game,
         Owner = owner,
         Name = owner.ToString()
     });
 }
コード例 #5
0
        /*
         * Parameters:
         * 0: channel owner
         */
        private void GetChannelsByOwner(HydraRequest request)
        {
            ChannelOwner owner = (ChannelOwner)int.Parse(request.Parameters[0]);

            Game    game    = Game.GetFromApiKey(request.ApiKey);
            Channel channel = Channel.ChannelGetByOwner(game, owner);

            HydraArray array = new HydraArray(new List <IHydraItem>()
            {
                new HydraInt64(channel.ID),
            });

            HydraResponse response = new HydraResponse(Connection, array);

            response.Send();
        }
コード例 #6
0
 /// <summary>
 /// Delete a channelOwner object and persist changes into the database
 /// </summary>
 /// <param name="channelOwner"></param>
 public void DeleteChannelOwner(ChannelOwner channelOwner)
 {
     // Remove the object into the database
     channelOwner.Delete();
 }
コード例 #7
0
 /// <summary>
 /// Update a channelOwner object and persist changes into the database
 /// </summary>
 /// <param name="channelOwner"></param>
 public void UpdateChannelOwner(ChannelOwner channelOwner)
 {
     // Persist the object into the database
     channelOwner.Save();
 }
コード例 #8
0
        /// <summary>
        ///     Load a channelOwner from the database given its Id.
        /// </summary>
        /// <returns></returns>
        private ChannelOwner LoadChannelOwner(int channelOwnerId)
        {
            var channelOwner = new ChannelOwner(new ChannelOwnerEntity(channelOwnerId));

            return(channelOwner);
        }