示例#1
0
        public void ProcessContainer(IEntityContainer container)
        {
            var              tabs        = this.GeneratorConfiguration.HierarchyStack.Count;
            var              tabText     = this.CurrentTabText;
            string           identitySet = null;
            HandlerStackItem handlerStackItem;

            if (container.Facets.Length > 0)
            {
                var facetList       = container.Facets.Select(f => string.Format("{0}[{1}]", tabText, f.AttributeCode)).ToMultiLineList();
                var uiHierarchyPath = container.Facets.GetUIHierarchyPathList(generatorOptions.PrintMode);

                this.CurrentUIHierarchyPath = uiHierarchyPath;

                WriteLine(facetList, PrintMode.PrintFacetsOnly);
                WriteLine(uiHierarchyPath, PrintMode.PrintUIHierarchyPathOnly);

                if (container.HasFacetAttribute <IdentityAttribute>())
                {
                    var identityAttribute = container.GetFacetAttribute <IdentityAttribute>();

                    identitySet = identityAttribute.IdentitySet;
                }

                if (container.HasFacetAttribute <ResourcesAttribute>())
                {
                    var resourcesAttribute = container.GetFacetAttribute <ResourcesAttribute>();

                    this.GeneratorConfiguration.ResourcesHandler = resourcesAttribute.CreateHandler();
                }
            }

            if (container.NoUIConfigOrFollow())
            {
                this.GeneratorConfiguration.HandleFacets(container);
            }
            else
            {
                handlerStackItem = this.GeneratorConfiguration.HandleFacets(container);
                this.GeneratorConfiguration.Push(handlerStackItem);
            }

            WriteLine("{0}{1}", PrintMode.All, tabText, container.Name);

            using (this.GeneratorConfiguration.PushContainer(container))
            {
                if (identitySet != null)
                {
                    var membershipSet = container.EntitySets.SingleOrDefault(e => e.Name == identitySet);

                    if (membershipSet != null)
                    {
                        ProcessEntitySet(membershipSet, true);
                    }
                }

                foreach (var entitySet in container.EntitySets)
                {
                    if (entitySet.CanFollowWithout())
                    {
                        ProcessEntitySet(entitySet);
                    }
                }
            }
        }