public void Resolve() { this.CoercePredicateActions(); using (var context = new ApplicationDbContext()) { var se = new ResourceSearchEngine(context); this.ConsequentResources = se.FindResources(this.Consequent.ObjectKeywords).ToList(); this.ConditionalResource = se.FindResources(this.Condition.ObjectKeywords).FirstOrDefault(); var possibleGroups = se.FindGroups(this.Consequent.ObjectKeywords); this.ConsequentResources.AddRange(possibleGroups.SelectMany(x => x.Resources)); } }
private void Resolve() { using (var context = new ApplicationDbContext()) { var se = new ResourceSearchEngine(context); // Only supporting a single group for the moment, so select the first one. this.Group = se.FindGroups(GroupKeywords).FirstOrDefault(); var candidateName = this.GroupKeywords.FirstOrDefault(); if (this.Group == null && !String.IsNullOrEmpty(candidateName)) { this.Group = new ResourceGroup() { Name = candidateName, Description = String.Empty, Id = Guid.NewGuid() }; } this.Resources = se.FindResources(this.ResourceKeywords); } }