コード例 #1
0
ファイル: ModelManager.cs プロジェクト: phekmat/ef6
        /// <summary>
        ///     Asks every EFElement in the given EFArtifactSet to create its normalized name and load that into
        ///     the global symbol table.
        /// </summary>
        private void NormalizeArtifactSet(EFArtifactSet artifactSet)
        {
            lock (this)
            {
                var visitor = new NormalizingVisitor();

                var lastMissedCount = -1;
                while (visitor.MissedCount != 0)
                {
                    visitor.ResetMissedCount();

                    foreach (var artifact in artifactSet.Artifacts)
                    {
                        visitor.Traverse(artifact);
                    }

                    // every item should be able to normalize
                    if (lastMissedCount == visitor.MissedCount)
                    {
                        throw new InvalidDataException("Subsequent passes didn't normalize any new items.");
                    }

                    lastMissedCount = visitor.MissedCount;
                }
            }
        }
コード例 #2
0
ファイル: ModelManager.cs プロジェクト: phekmat/ef6
        /// <summary>
        ///     Asks the passed in item all of its children to create its normalized name
        ///     and load that into the global symbol table.
        /// </summary>
        internal static void NormalizeItem(EFContainer item)
        {
            var visitor = new NormalizingVisitor();

            var lastMissedCount = -1;

            while (visitor.MissedCount != 0)
            {
                visitor.ResetMissedCount();
                visitor.Traverse(item);

                // every item should be able to normalize
                if (lastMissedCount == visitor.MissedCount)
                {
                    // subsequent passes didn't normalize any new items
                    throw new InvalidDataException();
                }

                lastMissedCount = visitor.MissedCount;
            }
        }