private static IEnumerable<IConceptInfo> InitializeNonparsablePropertiesRecursive(IAlternativeInitializationConcept alternativeInitializationConcept, HashSet<string> alreadyCreated, int depth, ILogger traceLogger)
        {
            if (depth > 10)
                throw new DslSyntaxException(alternativeInitializationConcept, "Macro concept references cannot be resolved.");

            List<IConceptInfo> result = new List<IConceptInfo>();

            IEnumerable<IConceptInfo> createdConcepts;
            alternativeInitializationConcept.InitializeNonparsableProperties(out createdConcepts);
            CsUtility.Materialize(ref createdConcepts);

            if (createdConcepts != null && createdConcepts.Count() > 0)
            {
                traceLogger.Trace(() => alternativeInitializationConcept.GetShortDescription() + " generated on alternative initialization: "
                    + string.Join(", ", createdConcepts.Select(c => c.GetShortDescription())) + ".");

                result.AddRange(createdConcepts);
                foreach (var concept in createdConcepts.OfType<IAlternativeInitializationConcept>())
                    if (!alreadyCreated.Contains(concept.GetFullDescription()))
                    {
                        alreadyCreated.Add(concept.GetFullDescription());
                        result.AddRange(InitializeNonparsablePropertiesRecursive(concept, alreadyCreated, depth + 1, traceLogger));
                    }
            }

            return result;
        }
示例#2
0
        private static IEnumerable<IConceptInfo> InitializeNonparsablePropertiesRecursive(IAlternativeInitializationConcept alternativeInitializationConcept, HashSet<string> alreadyCreated, int depth)
        {
            if (depth > 10)
                throw new DslSyntaxException("Macro concept references cannot be resolved.");

            IEnumerable<IConceptInfo> createdConcepts;
            List<IConceptInfo> result = new List<IConceptInfo>();
            alternativeInitializationConcept.InitializeNonparsableProperties(out createdConcepts);
            if (createdConcepts != null && createdConcepts.Count() > 0)
            {
                result.AddRange(createdConcepts);
                foreach (var concept in createdConcepts.OfType<IAlternativeInitializationConcept>())
                    if (!alreadyCreated.Contains(concept.GetFullDescription()))
                    {
                        alreadyCreated.Add(concept.GetFullDescription());
                        result.AddRange(InitializeNonparsablePropertiesRecursive(concept, alreadyCreated, depth + 1));
                    }
            }
            return result;
        }
        private static IEnumerable <IConceptInfo> InitializeNonparsablePropertiesRecursive(IAlternativeInitializationConcept alternativeInitializationConcept, HashSet <string> alreadyCreated, int depth, ILogger traceLogger)
        {
            if (depth > 10)
            {
                throw new DslSyntaxException(alternativeInitializationConcept, "Macro concept references cannot be resolved.");
            }

            List <IConceptInfo> result = new List <IConceptInfo>();

            IEnumerable <IConceptInfo> createdConcepts;

            alternativeInitializationConcept.InitializeNonparsableProperties(out createdConcepts);
            CsUtility.Materialize(ref createdConcepts);

            if (createdConcepts != null && createdConcepts.Count() > 0)
            {
                traceLogger.Trace(() => alternativeInitializationConcept.GetShortDescription() + " generated on alternative initialization: "
                                  + string.Join(", ", createdConcepts.Select(c => c.GetShortDescription())) + ".");

                result.AddRange(createdConcepts);
                foreach (var concept in createdConcepts.OfType <IAlternativeInitializationConcept>())
                {
                    if (!alreadyCreated.Contains(concept.GetFullDescription()))
                    {
                        alreadyCreated.Add(concept.GetFullDescription());
                        result.AddRange(InitializeNonparsablePropertiesRecursive(concept, alreadyCreated, depth + 1, traceLogger));
                    }
                }
            }

            return(result);
        }
示例#4
0
 public static IEnumerable<IConceptInfo> InitializeNonparsablePropertiesRecursive(IAlternativeInitializationConcept alternativeInitializationConcept)
 {
     return InitializeNonparsablePropertiesRecursive(alternativeInitializationConcept, new HashSet<string>(), 0);
 }