public Index_EndpointsIndex() { this.ViewText = @"from message in docs.ProcessedMessages select new { message = message, sending = (message.MessageMetadata[""SendingEndpoint""]) } into this0 select new { this0 = this0, receiving = (this0.message.MessageMetadata[""ReceivingEndpoint""]) } into this1 from endpoint in new[] { this1.this0.sending, this1.receiving } select new { this1 = this1, endpoint = endpoint } into this2 where this2.endpoint != null select new { Host = this2.endpoint.Host, HostId = this2.endpoint.HostId, Name = this2.endpoint.Name } from result in results group result by new { Name = result.Name, HostId = result.HostId } into grouped select new { grouped = grouped, first = DynamicEnumerable.FirstOrDefault(grouped) } into this0 select new { Host = this0.first.Host, HostId = this0.first.HostId, Name = this0.first.Name }"; this.ForEntityNames.Add("ProcessedMessages"); this.AddMapDefinition(docs => from message in ((IEnumerable <dynamic>)docs) where string.Equals(message["@metadata"]["Raven-Entity-Name"], "ProcessedMessages", System.StringComparison.InvariantCultureIgnoreCase) select new { message = message, sending = (message.MessageMetadata["SendingEndpoint"]), __document_id = message.__document_id } into this0 select new { this0 = this0, receiving = (this0.message.MessageMetadata["ReceivingEndpoint"]), __document_id = this0.__document_id } into this1 from endpoint in ((IEnumerable <dynamic>) new[] { this1.this0.sending, this1.receiving }) select new { this1 = this1, endpoint = endpoint, __document_id = this1.__document_id } into this2 where this2.endpoint != null select new { Host = this2.endpoint.Host, HostId = this2.endpoint.HostId, Name = this2.endpoint.Name, __document_id = this2.__document_id }); this.ReduceDefinition = results => from result in results group result by new { Name = result.Name, HostId = result.HostId } into grouped select new { grouped = grouped, first = DynamicEnumerable.FirstOrDefault(grouped) } into this0 select new { Host = this0.first.Host, HostId = this0.first.HostId, Name = this0.first.Name }; this.GroupByExtraction = result => new { Name = result.Name, HostId = result.HostId }; this.AddField("Host"); this.AddField("HostId"); this.AddField("Name"); this.AddQueryParameterForMap("__document_id"); this.AddQueryParameterForMap("endpoint.Host"); this.AddQueryParameterForMap("endpoint.HostId"); this.AddQueryParameterForMap("endpoint.Name"); this.AddQueryParameterForReduce("__document_id"); this.AddQueryParameterForReduce("endpoint.Host"); this.AddQueryParameterForReduce("endpoint.HostId"); this.AddQueryParameterForReduce("endpoint.Name"); }
public static dynamic FirstOrDefault(this IGrouping <dynamic, dynamic> self, Func <dynamic, bool> predicate) { return(DynamicEnumerable.FirstOrDefault(self, predicate)); }
public static dynamic FirstOrDefault(this IGrouping <dynamic, dynamic> self) { return(DynamicEnumerable.FirstOrDefault(self)); }
public Index_SagaListIndex() { this.ViewText = @"from doc in docs.SagaSnapshots select new { Id = doc.SagaId, Uri = ""api/sagas/"" + doc.SagaId, SagaType = doc.SagaType } from doc in docs.SagaHistories select new { Id = doc.SagaId, Uri = ""api/sagas/"" + doc.SagaId, SagaType = doc.SagaType } from result in results group result by result.Id into g select new { g = g, first = DynamicEnumerable.FirstOrDefault(g) } into this0 select new { Id = this0.g.Key, Uri = this0.first.Uri, SagaType = this0.first.SagaType }"; this.ForEntityNames.Add("SagaSnapshots"); this.AddMapDefinition(docs => from doc in ((IEnumerable <dynamic>)docs) where string.Equals(doc["@metadata"]["Raven-Entity-Name"], "SagaSnapshots", System.StringComparison.InvariantCultureIgnoreCase) select new { Id = doc.SagaId, Uri = "api/sagas/" + doc.SagaId, SagaType = doc.SagaType, __document_id = doc.__document_id }); this.ForEntityNames.Add("SagaHistories"); this.AddMapDefinition(docs => from doc in ((IEnumerable <dynamic>)docs) where string.Equals(doc["@metadata"]["Raven-Entity-Name"], "SagaHistories", System.StringComparison.InvariantCultureIgnoreCase) select new { Id = doc.SagaId, Uri = "api/sagas/" + doc.SagaId, SagaType = doc.SagaType, __document_id = doc.__document_id }); this.ReduceDefinition = results => from result in results group result by result.Id into g select new { g = g, first = DynamicEnumerable.FirstOrDefault(g) } into this0 select new { Id = this0.g.Key, Uri = this0.first.Uri, SagaType = this0.first.SagaType }; this.GroupByExtraction = result => result.Id; this.AddField("Id"); this.AddField("Uri"); this.AddField("SagaType"); this.AddQueryParameterForMap("SagaId"); this.AddQueryParameterForMap("SagaType"); this.AddQueryParameterForMap("__document_id"); this.AddQueryParameterForReduce("SagaId"); this.AddQueryParameterForReduce("SagaType"); this.AddQueryParameterForReduce("__document_id"); }
public Index_SagaDetailsIndex() { this.ViewText = @"from doc in docs.SagaSnapshots select new { SagaId = doc.SagaId, Id = doc.SagaId, SagaType = doc.SagaType, Changes = new[] { new { Endpoint = doc.Endpoint, FinishTime = doc.FinishTime, InitiatingMessage = doc.InitiatingMessage, OutgoingMessages = doc.OutgoingMessages, StartTime = doc.StartTime, StateAfterChange = doc.StateAfterChange, Status = doc.Status } } } from doc in docs.SagaHistories select new { SagaId = doc.SagaId, Id = doc.SagaId, SagaType = doc.SagaType, Changes = doc.Changes } from result in results group result by result.SagaId into g select new { g = g, first = DynamicEnumerable.FirstOrDefault(g) } into this0 select new { Id = this0.first.SagaId, SagaId = this0.first.SagaId, SagaType = this0.first.SagaType, Changes = Enumerable.ToList(this0.g.SelectMany(x => x.Changes).OrderByDescending(x0 => x0.FinishTime)) }"; this.ForEntityNames.Add("SagaSnapshots"); this.AddMapDefinition(docs => from doc in ((IEnumerable <dynamic>)docs) where string.Equals(doc["@metadata"]["Raven-Entity-Name"], "SagaSnapshots", System.StringComparison.InvariantCultureIgnoreCase) select new { SagaId = doc.SagaId, Id = doc.SagaId, SagaType = doc.SagaType, Changes = new[] { new { Endpoint = doc.Endpoint, FinishTime = doc.FinishTime, InitiatingMessage = doc.InitiatingMessage, OutgoingMessages = doc.OutgoingMessages, StartTime = doc.StartTime, StateAfterChange = doc.StateAfterChange, Status = doc.Status } }, __document_id = doc.__document_id }); this.ForEntityNames.Add("SagaHistories"); this.AddMapDefinition(docs => from doc in ((IEnumerable <dynamic>)docs) where string.Equals(doc["@metadata"]["Raven-Entity-Name"], "SagaHistories", System.StringComparison.InvariantCultureIgnoreCase) select new { SagaId = doc.SagaId, Id = doc.SagaId, SagaType = doc.SagaType, Changes = doc.Changes, __document_id = doc.__document_id }); this.ReduceDefinition = results => from result in results group result by result.SagaId into g select new { g = g, first = DynamicEnumerable.FirstOrDefault(g) } into this0 select new { Id = this0.first.SagaId, SagaId = this0.first.SagaId, SagaType = this0.first.SagaType, Changes = Enumerable.ToList(this0.g.SelectMany((Func <dynamic, IEnumerable <dynamic> >)(x => (IEnumerable <dynamic>)(x.Changes))).OrderByDescending((Func <dynamic, dynamic>)(x0 => x0.FinishTime))) }; this.GroupByExtraction = result => result.SagaId; this.AddField("Id"); this.AddField("SagaId"); this.AddField("SagaType"); this.AddField("Changes"); this.AddQueryParameterForMap("SagaId"); this.AddQueryParameterForMap("SagaType"); this.AddQueryParameterForMap("__document_id"); this.AddQueryParameterForMap("Changes"); this.AddQueryParameterForReduce("SagaId"); this.AddQueryParameterForReduce("SagaType"); this.AddQueryParameterForReduce("__document_id"); this.AddQueryParameterForReduce("Changes"); }
public Index_RetryBatches_ByStatus_ReduceInitialBatchSize() { this.ViewText = @"from doc in docs.RetryBatches select new { RequestId = doc.RequestId, RetryType = doc.RetryType, HasStagingBatches = doc.Status == 2, HasForwardingBatches = doc.Status == 3, InitialBatchSize = doc.InitialBatchSize, Originator = doc.Originator, Classifier = doc.Classifier, StartTime = doc.StartTime, Last = doc.Last } from result in results group result by new { RequestId = result.RequestId, RetryType = result.RetryType } into g select new { RequestId = g.Key.RequestId, RetryType = g.Key.RetryType, Originator = (DynamicEnumerable.FirstOrDefault(g)).Originator, HasStagingBatches = Enumerable.Any(g, x => x.HasStagingBatches), HasForwardingBatches = Enumerable.Any(g, x0 => x0.HasForwardingBatches), InitialBatchSize = Enumerable.Sum(g, x1 => ((int)x1.InitialBatchSize)), StartTime = (DynamicEnumerable.FirstOrDefault(g)).StartTime, Last = DynamicEnumerable.Max(g, x2 => ((DateTime)x2.Last)), Classifier = (DynamicEnumerable.FirstOrDefault(g)).Classifier }"; this.ForEntityNames.Add("RetryBatches"); this.AddMapDefinition(docs => from doc in ((IEnumerable <dynamic>)docs) where string.Equals(doc["@metadata"]["Raven-Entity-Name"], "RetryBatches", System.StringComparison.InvariantCultureIgnoreCase) select new { RequestId = doc.RequestId, RetryType = doc.RetryType, HasStagingBatches = doc.Status == 2, HasForwardingBatches = doc.Status == 3, InitialBatchSize = doc.InitialBatchSize, Originator = doc.Originator, Classifier = doc.Classifier, StartTime = doc.StartTime, Last = doc.Last, __document_id = doc.__document_id }); this.ReduceDefinition = results => from result in results group result by new { RequestId = result.RequestId, RetryType = result.RetryType } into g select new { RequestId = g.Key.RequestId, RetryType = g.Key.RetryType, Originator = (DynamicEnumerable.FirstOrDefault(g)).Originator, HasStagingBatches = Enumerable.Any(g, (Func <dynamic, bool>)(x => x.HasStagingBatches)), HasForwardingBatches = Enumerable.Any(g, (Func <dynamic, bool>)(x0 => x0.HasForwardingBatches)), InitialBatchSize = Enumerable.Sum(g, (Func <dynamic, int>)(x1 => ((int)x1.InitialBatchSize))), StartTime = (DynamicEnumerable.FirstOrDefault(g)).StartTime, Last = DynamicEnumerable.Max(g, (Func <dynamic, DateTime>)(x2 => ((DateTime)x2.Last))), Classifier = (DynamicEnumerable.FirstOrDefault(g)).Classifier }; this.GroupByExtraction = result => new { RequestId = result.RequestId, RetryType = result.RetryType }; this.AddField("RequestId"); this.AddField("RetryType"); this.AddField("Originator"); this.AddField("HasStagingBatches"); this.AddField("HasForwardingBatches"); this.AddField("InitialBatchSize"); this.AddField("StartTime"); this.AddField("Last"); this.AddField("Classifier"); this.AddQueryParameterForMap("RequestId"); this.AddQueryParameterForMap("RetryType"); this.AddQueryParameterForMap("InitialBatchSize"); this.AddQueryParameterForMap("Originator"); this.AddQueryParameterForMap("Classifier"); this.AddQueryParameterForMap("StartTime"); this.AddQueryParameterForMap("Last"); this.AddQueryParameterForMap("__document_id"); this.AddQueryParameterForReduce("RequestId"); this.AddQueryParameterForReduce("RetryType"); this.AddQueryParameterForReduce("InitialBatchSize"); this.AddQueryParameterForReduce("Originator"); this.AddQueryParameterForReduce("Classifier"); this.AddQueryParameterForReduce("StartTime"); this.AddQueryParameterForReduce("Last"); this.AddQueryParameterForReduce("__document_id"); }