private void LoadAlternateAes()
        {
            if (!_aeTitlesLoaded)
            {
                lock (_syncLock)
                {
                    if (!_aeTitlesLoaded)
                    {
                        using (var context = new ServerExecutionContext())
                        {
                            var broker = context.ReadContext.GetBroker<IServerPartitionAlternateAeTitleEntityBroker>();
                            var criteria = new ServerPartitionAlternateAeTitleSelectCriteria();
                            criteria.ServerPartitionKey.EqualTo(this.Key);
                            _alternateAeTitles = broker.Find(criteria);
                        }

                        _aeTitlesLoaded = true;
                    }
                }
            }
        }
 public ServerPartitionAlternateAeTitleSelectCriteria(ServerPartitionAlternateAeTitleSelectCriteria other)
 : base(other)
 {}
 public ServerPartitionAlternateAeTitleSelectCriteria(ServerPartitionAlternateAeTitleSelectCriteria other)
     : base(other)
 {
 }
		/// <summary>
		/// Internal method for loading partition information fromt he database.
		/// </summary>
		private void LoadPartitions()
        {
            bool changed = false;
            lock (_partitionsLock)
            {
                try
                {
                    var templist = new Dictionary<string, ServerPartition>();
                    var tempAeList = new Dictionary<string, ServerPartitionAlternateAeTitle>();

                    IPersistentStore store = PersistentStoreRegistry.GetDefaultStore();
                    using (IReadContext ctx = store.OpenReadContext())
                    {
                        var broker = ctx.GetBroker<IServerPartitionEntityBroker>();
                        var criteria = new ServerPartitionSelectCriteria();
                        IList<ServerPartition> list = broker.Find(criteria);
                        foreach (ServerPartition partition in list)
                        {
                            if (IsChanged(partition))
                            {
                                changed = true;
                            }

                            templist.Add(partition.AeTitle, partition);
                        }

                        var aeBroker = ctx.GetBroker<IServerPartitionAlternateAeTitleEntityBroker>();
                        var aeCriteria = new ServerPartitionAlternateAeTitleSelectCriteria();
                        IList<ServerPartitionAlternateAeTitle> aeList = aeBroker.Find(aeCriteria);
                        foreach (ServerPartitionAlternateAeTitle partitionAe in aeList)
                        {
                            if (IsChanged(partitionAe))
                            {
                                changed = true;
                            }

                            tempAeList.Add(partitionAe.AeTitle, partitionAe);
                        }
                    }

                    if (_partitions.Count != templist.Count)
                        changed = true;
                    if (_alternateAeTitles.Count != tempAeList.Count)
                        changed = true;

                    _partitions = templist;
                    _alternateAeTitles = tempAeList;

                    if (changed && _changedListener != null)
                    {
                        EventsHelper.Fire(_changedListener, this, new ServerPartitionChangedEventArgs(this));
                    }
                }
                catch(Exception ex)
                {
                    Platform.Log(LogLevel.Error, ex,
                             "Unexpected exception when loading partitions, possible database error.  Operation will be retried later");
                }
            }// lock
        }