Ejemplo n.º 1
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;
            
            var query = new TableQuery<MessageLogEntity>()
                            .Where(x => x.Kind == StandardMetadata.EventKind); 

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

            var table = context.GetTableReference(this.tableName);
            return table.ExecuteQuery(query.AsTableQuery())
                        .ToList()
                        .Select(e => this.serializer.Deserialize<IEvent>(e.Payload));
        }