Exemple #1
0
        /// <summary>
        /// Sends a command to an aggregate using the aggregate's category as the stream id.
        /// </summary>
        public Task SendAggregateCommand <T>(object command, TimeSpan?timeout = null)
            where T : Aggregate
        {
            var stream = ESCategoryAttribute.GetCategory(typeof(T));

            return(SendAggregateCommand <T>(stream, command, timeout));
        }
Exemple #2
0
        /// <summary>
        /// Sends a command to an aggregate using the aggregate's category and an id to compose the stream id.
        /// The stream will be generated as "category-id".
        /// </summary>
        public Task <CommandResult> SendAggregateCommand <T>(object id, object command, TimeSpan?timeout = null)
            where T : Aggregate
        {
            Contract.Requires(id != null);

            var category = ESCategoryAttribute.GetCategory(typeof(T));
            var stream   = id != null ? category + "-" + id.ToString() : category;

            return(SendAggregateCommand <T>(stream, command, timeout));
        }
Exemple #3
0
        private void Uninitialized()
        {
            Receive <InitializeAggregate>(ini =>
            {
                Category = ESCategoryAttribute.GetCategory(this.GetType());

                _reader    = ini.Reader;
                _writer    = ini.Writer;
                _options   = ini.Options;
                _validator = _options.DefaultCommandValidator;

                Become(AwaitingFirstCommand);
                Stash.UnstashAll();
            });

            ReceiveAny(o => Stash.Stash());
        }