Beispiel #1
0
        IEnumerable <IApplicationLocation> GetLocationSegmentsFrom(ISegmentMatches match)
        {
            var matchAsDictionary = match.AsDictionary();

            var               segments       = new List <IApplicationLocation>();
            BoundedContext    boundedContext = null;
            Module            module         = null;
            Feature           feature        = null;
            List <SubFeature> subFeatures    = new List <SubFeature>();

            if (matchAsDictionary.ContainsKey(BoundedContextKey))
            {
                boundedContext = new BoundedContext(matchAsDictionary[BoundedContextKey].Single());
                segments.Add(boundedContext);

                if (matchAsDictionary.ContainsKey(ModuleKey))
                {
                    module = new Module(boundedContext, matchAsDictionary[ModuleKey].Single());
                    segments.Add(module);

                    if (matchAsDictionary.ContainsKey(FeatureKey))
                    {
                        feature = new Feature(module, matchAsDictionary[FeatureKey].Single());
                        segments.Add(feature);

                        if (matchAsDictionary.ContainsKey(SubFeatureKey))
                        {
                            foreach (var subFeatureName in matchAsDictionary[SubFeatureKey])
                            {
                                var subFeature = new SubFeature(feature, subFeatureName);
                                segments.Add(subFeature);
                            }
                        }
                    }
                }
            }

            return(segments);
        }
        /// <summary>
        /// Convert into a <see cref="IDictionary{TKey, TValue}"/>
        /// </summary>
        /// <param name="segmentMatches"></param>
        /// <returns></returns>
        public static IDictionary <string, IEnumerable <string> > AsDictionary(this ISegmentMatches segmentMatches)
        {
            var dictionary = segmentMatches.ToDictionary(s => s.Identifier, s => s.Values);

            return(dictionary);
        }