Exemplo n.º 1
0
        public new IEnumerable<ICommand> Query(QueryCriteria criteria)
        {
            var context = this.tableClient.GetDataServiceContext();
            var query = (IQueryable<MessageLogEntity>)context.CreateQuery<MessageLogEntity>(this.tableName)
                .Where(x => x.Kind == StandardMetadata.CommandKind);

            var where = criteria.ToExpression();
            if (where != null)
                query = query.Where(where);

            return query
                .AsTableServiceQuery()
                .Execute()
                .Select(e => this.serializer.Deserialize<ICommand>(e.Payload));
        }
Exemplo n.º 2
0
        // NOTE: we don't have a need (yet?) to query commands, as we don't use them to
        // recreate read models, nor we are using it for BI, so we just
        // expose events.
        public IEnumerable<IEvent> Query(QueryCriteria criteria)
        {
            var context = this.tableClient.GetTableReference(this.tableName);;
            var query = (IQueryable<MessageLogEntity>)context.CreateQuery<MessageLogEntity>()
                .Where(x => x.Kind == StandardMetadata.EventKind);

            var where = criteria.ToExpression();
            if (where != null)
                query = query.Where(where);

            return query
                .AsTableQuery()
                .Execute()
                .Select(e => this.serializer.Deserialize<IEvent>(e.Payload));
        }