public MyAppElasticConfiguration(IQueue<WorkItemData> workItemQueue, ICacheClient cacheClient, IMessageBus messageBus, ILoggerFactory loggerFactory) : base(workItemQueue, cacheClient, messageBus, loggerFactory) {
     AddIndex(Identities = new IdentityIndex(this));
     AddIndex(Employees = new EmployeeIndex(this));
     AddIndex(MonthlyEmployees = new MonthlyEmployeeIndex(this, 1));
     AddIndex(DailyLogEvents = new DailyLogEventIndex(this));
     AddIndex(MonthlyLogEvents = new MonthlyLogEventIndex(this));
     AddIndex(ParentChild = new ParentChildIndex(this));
 }
Example #2
0
 public MyAppElasticConfiguration(IQueue <WorkItemData> workItemQueue, ICacheClient cacheClient, IMessageBus messageBus, ILoggerFactory loggerFactory) : base(workItemQueue, cacheClient, messageBus, loggerFactory)
 {
     AddIndex(Identities       = new IdentityIndex(this));
     AddIndex(Employees        = new EmployeeIndex(this));
     AddIndex(MonthlyEmployees = new MonthlyEmployeeIndex(this, 1));
     AddIndex(DailyLogEvents   = new DailyLogEventIndex(this));
     AddIndex(MonthlyLogEvents = new MonthlyLogEventIndex(this));
     AddIndex(ParentChild      = new ParentChildIndex(this));
 }
Example #3
0
 private static void OutputArray(IGrouping<XName, XElement> elementGroup, IdentityIndex.Identity identity, JObject result) {
     int n = 0;
     var container = new JObject();
     foreach (var eachElement in elementGroup) {
         var item = new JObject();
         foreach (var attr in eachElement.AllAttributes().Where(attr => !attr.IsNamespaceDeclaration)) {
             if (IdentityIndex[attr.Name] != null) {
                 item.Add(IdentityIndex[attr.Name].JsonName, attr.Value);
             } else {
                 item.Add(attr.Name.LocalName, attr.Value);
             }
         }
         container.Add((n++).ToString(), item);
     }
     result.Add(identity.JsonName, container);
 }
Example #4
0
        private static void OutputKeyedArray(IGrouping<XName, XElement> elementGroup, IdentityIndex.Identity identity, JObject result) {
            var container = new JObject();
            foreach (var eachElement in elementGroup) {
                var item = new JObject();

                // add every attribute we have a match for.
                foreach (var attr in eachElement.AllAttributes().Where(attr => attr.Name != identity.Index && !attr.IsNamespaceDeclaration)) {
                    item.Add(IdentityIndex[attr.Name].JsonName, attr.Value);
                }
                var indexValue = eachElement.GetAttribute(identity.Index);

                if (indexValue != null) {
                    container.Add(indexValue, item);
                }

                // handle child elements
                foreach (var childGroup in eachElement.Elements().GroupBy(each => each.Name)) {
                    var i = IdentityIndex[childGroup.Key];

                    if (i != null) {
                        // we know what type this is

                        if (i.Index != null) {
                            // we know what attribute we want to use as an index.
                            OutputKeyedArray(childGroup, i, item);
                        }
                    }
                }

            }
            result.Add(identity.JsonName, container);
        }