/// <summary>
        /// Create the projection from the attribute linked to the function parameter
        /// </summary>
        /// <param name="attribute">
        /// The attribute describing which projection to run
        /// </param>
        public Classification(ClassificationAttribute attribute,
                              IEventStreamSettings settings = null)
        {
            _domainName         = attribute.DomainName;
            _entityTypeName     = attribute.EntityTypeName;
            _instanceKey        = attribute.InstanceKey;
            _classifierTypeName = attribute.ClassifierTypeName;


            if (null == settings)
            {
                _settings = new EventStreamSettings();
            }
            else
            {
                _settings = settings;
            }

            _connectionStringName = _settings.GetConnectionStringName(attribute);

            if (null == _classificationProcessor)
            {
                _classificationProcessor = _settings.CreateClassificationProcessorForEventStream(attribute);
            }
        }
예제 #2
0
        /// <summary>
        /// Create the projection from the attribute linked to the function parameter
        /// </summary>
        /// <param name="attribute">
        /// The attribute describing which projection to run
        /// </param>
        public Classification(ClassificationAttribute attribute,
                              IEventStreamSettings settings                = null,
                              INotificationDispatcher dispatcher           = null,
                              IClassificationSnapshotReader snapshotReader = null,
                              IClassificationSnapshotWriter snapshotWriter = null)
        {
            _domainName         = attribute.DomainName;
            _entityTypeName     = attribute.EntityTypeName;
            _instanceKey        = attribute.InstanceKey;
            _classifierTypeName = attribute.ClassifierTypeName;


            if (null == settings)
            {
                _settings = new EventStreamSettings();
            }
            else
            {
                _settings = settings;
            }

            _connectionStringName = _settings.GetConnectionStringName(attribute);

            if (null == _classificationProcessor)
            {
                _classificationProcessor = _settings.CreateClassificationProcessorForEventStream(attribute);
            }

            if (null == dispatcher)
            {
                // Create a new dispatcher
                _notificationDispatcher = NotificationDispatcherFactory.NotificationDispatcher;
            }
            else
            {
                _notificationDispatcher = dispatcher;
            }

            if (null != snapshotReader)
            {
                _snapshotReader = snapshotReader;
            }

            if (null != snapshotWriter)
            {
                _snapshotWriter = snapshotWriter;
            }
        }