Example #1
0
        public QueryEngineRegistry(IQueryEngineRegistry parent)
        {
            Debug.Assert(parent != null);

            _parent = parent;

            _localSubjects = new ReactiveEntityCollection <string, SubjectEntity>(StringComparer.Ordinal);
            Subjects       = new ChainedLookupReactiveEntityCollection <string, SubjectEntity>(_localSubjects, _parent.Subjects);

            _localObservables = new ReactiveEntityCollection <string, ObservableDefinitionEntity>(StringComparer.Ordinal);
            var localObservablesAndSubjects = new ChainedLookupReactiveEntityCollection <string, ObservableDefinitionEntity, SubjectEntity>(_localObservables, _localSubjects, s => ObservableDefinitionEntity.FromSubject(s));

            Observables = new ChainedLookupReactiveEntityCollection <string, ObservableDefinitionEntity>(localObservablesAndSubjects, _parent.Observables);

            _localObservers = new ReactiveEntityCollection <string, ObserverDefinitionEntity>(StringComparer.Ordinal);
            var localObserversAndSubjects = new ChainedLookupReactiveEntityCollection <string, ObserverDefinitionEntity, SubjectEntity>(_localObservers, _localSubjects, s => ObserverDefinitionEntity.FromSubject(s));

            Observers = new ChainedLookupReactiveEntityCollection <string, ObserverDefinitionEntity>(localObserversAndSubjects, _parent.Observers);

            _localSubjectFactories = new ReactiveEntityCollection <string, StreamFactoryDefinitionEntity>(StringComparer.Ordinal);
            SubjectFactories       = new ChainedLookupReactiveEntityCollection <string, StreamFactoryDefinitionEntity>(_localSubjectFactories, _parent.SubjectFactories);

            _localSubscriptionFactories = new ReactiveEntityCollection <string, SubscriptionFactoryDefinitionEntity>(StringComparer.Ordinal);
            SubscriptionFactories       = new ChainedLookupReactiveEntityCollection <string, SubscriptionFactoryDefinitionEntity>(_localSubscriptionFactories, _parent.SubscriptionFactories);

            _localSubscriptions = new ReactiveEntityCollection <string, SubscriptionEntity>(StringComparer.Ordinal);
            Subscriptions       = new ChainedLookupReactiveEntityCollection <string, SubscriptionEntity>(_localSubscriptions, _parent.Subscriptions);

            _localOther = new ReactiveEntityCollection <string, DefinitionEntity>(StringComparer.Ordinal);
            Other       = new ChainedLookupReactiveEntityCollection <string, DefinitionEntity>(_localOther, _parent.Other);

            _localReliableSubscriptions = new ReactiveEntityCollection <string, ReliableSubscriptionEntity>(StringComparer.Ordinal);
            ReliableSubscriptions       = new ChainedLookupReactiveEntityCollection <string, ReliableSubscriptionEntity>(_localReliableSubscriptions, _parent.ReliableSubscriptions);

            _localTemplates = new ReactiveEntityCollection <string, DefinitionEntity>(StringComparer.Ordinal);
            var chainedTemplates = new ChainedLookupReactiveEntityCollection <string, DefinitionEntity>(_localTemplates, _parent.Templates);

            Templates = new InvertedLookupReactiveEntityCollection <string, DefinitionEntity>(chainedTemplates, InvertedDefinitionEntityComparer.Default);
        }
Example #2
0
            public BuiltinEntitiesRegistry(CheckpointingQueryEngine queryEngine, IReactiveMetadata metadata)
            {
                Debug.Assert(queryEngine != null);
                Debug.Assert(metadata != null);

                _queryEngine = queryEngine;
                _subjects    = new ReactiveEntityCollection <string, SubjectEntity>(StringComparer.Ordinal);

                var localObservables            = new ReactiveEntityCollection <string, ObservableDefinitionEntity>(StringComparer.Ordinal);
                var localObservablesAndSubjects = new ChainedLookupReactiveEntityCollection <string, ObservableDefinitionEntity, SubjectEntity>(localObservables, _subjects, s => ObservableDefinitionEntity.FromSubject(s));

                _observables = new ExternalLookupReactiveEntityCollection <ObservableDefinitionEntity>(localObservablesAndSubjects, TryLookupObservable, metadata);

                var localObservers            = new ReactiveEntityCollection <string, ObserverDefinitionEntity>(StringComparer.Ordinal);
                var localObserversAndSubjects = new ChainedLookupReactiveEntityCollection <string, ObserverDefinitionEntity, SubjectEntity>(localObservers, _subjects, s => ObserverDefinitionEntity.FromSubject(s));

                _observers = new ExternalLookupReactiveEntityCollection <ObserverDefinitionEntity>(localObserversAndSubjects, TryLookupObserver, metadata);

                var localSubjectFactories = new ReactiveEntityCollection <string, StreamFactoryDefinitionEntity>(StringComparer.Ordinal);

                _subjectFactories = new ExternalLookupReactiveEntityCollection <StreamFactoryDefinitionEntity>(localSubjectFactories, TryLookupStreamFactory, metadata);

                var localSubscriptionFactories = new ReactiveEntityCollection <string, SubscriptionFactoryDefinitionEntity>(StringComparer.Ordinal);

                _subscriptionFactories = new ExternalLookupReactiveEntityCollection <SubscriptionFactoryDefinitionEntity>(localSubscriptionFactories, TryLookupSubscriptionFactory, metadata);

                _other     = new ReactiveEntityCollection <string, DefinitionEntity>(StringComparer.Ordinal);
                _templates = new InvertedLookupReactiveEntityCollection <string, DefinitionEntity>(StringComparer.Ordinal, InvertedDefinitionEntityComparer.Default);

                _subscriptions         = new ReactiveEntityCollection <string, SubscriptionEntity>(StringComparer.Ordinal);
                _reliableSubscriptions = new ReactiveEntityCollection <string, ReliableSubscriptionEntity>(StringComparer.Ordinal);

                _metadataRewrites = new ConditionalWeakTable <Expression, Expression>();

                InitializeBuiltinDefinitions(queryEngine);
            }