/// <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);
            }
        }
        public static Task <Classification> BuildClassificationFromAttribute(ClassificationAttribute attribute,
                                                                             ValueBindingContext context)
        {
            // If possible get the connection string to use

            // Use this and the attribute to create a new classifier instance
            return(Task <Classification> .FromResult(new Classification (attribute)));
        }
示例#3
0
        /// <summary>
        /// Create a classification processor to run over the given event stream's backing store
        /// </summary>
        public IClassificationProcessor CreateClassificationProcessorForEventStream(ClassificationAttribute attribute)
        {
            string connectionStringName = GetConnectionStringName(attribute);

            if (GetBackingImplementationType(attribute).Equals(EventStreamSetting.EVENTSTREAMIMPLEMENTATIOIN_TABLE, StringComparison.OrdinalIgnoreCase))
            {
                return(TableEventStreamReader.CreateClassificationProcessor(attribute, connectionStringName: connectionStringName));
            }

            // Default to AppendBlob
            return(BlobEventStreamReader.CreateClassificationProcessor(attribute, connectionStringName));
        }
示例#4
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;
            }
        }