コード例 #1
0
        /// <exclude />
        public string GetResult()
        {
            EntityTokenHtmlPrettyfierHelper helper = new EntityTokenHtmlPrettyfierHelper();

            helper.StartTable();
            helper.AddHeading("<b>Basic Information</b>");
            OnWriteEntityTokenType(this.EntityToken, helper);
            OnWriteType(this.EntityToken, helper);
            OnWriteSource(this.EntityToken, helper);
            OnWriteId(this.EntityToken, helper);

            var extraInfo = EntityToken.OnGetExtraPrettyHtml();

            if (!extraInfo.IsNullOrEmpty())
            {
                helper.AddFullRow(new[] { "<b>Extra</b>", extraInfo });
            }

            helper.AddHeading("<b>Custom Properties</b>");
            foreach (var kvp in _customProperties)
            {
                PropertyInfo propertyInfo = this.EntityToken.GetType().GetPropertiesRecursively().Single(f => f.Name == kvp.Key);
                kvp.Value(kvp.Key, propertyInfo.GetValue(this.EntityToken, null), helper);
            }


            helper.AddHeading("<b>Piggybag</b>");
            foreach (var kvp in this.PiggyBag)
            {
                OnPiggyBagEntry(kvp.Key, kvp.Value, helper);
            }

            helper.AddHeading("<b>SecurityAncestorProvider</b>");
            SecurityAncestorProviderAttribute attribute = this.EntityToken.GetType().GetCustomAttributesRecursively <SecurityAncestorProviderAttribute>().SingleOrDefault();

            OnWriteSecurityAncestorProvider(attribute, helper);


            helper.AddHeading("<b>AuxiliarySecurityAncestorProviders</b>");
            foreach (IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider in AuxiliarySecurityAncestorFacade.GetAuxiliaryAncestorProviders(this.EntityToken.GetType()))
            {
                OnWriteAuxiliarySecurityAncestorProvider(auxiliarySecurityAncestorProvider, helper);
            }

            helper.EndTable();

            return(helper.GetResult());
        }
コード例 #2
0
        /// <exclude />
        public string GetResult()
        {
            EntityTokenHtmlPrettyfierHelper helper = new EntityTokenHtmlPrettyfierHelper();

            helper.StartTable();
            helper.AddHeading("<b>Basic Information</b>");
            OnWriteEntityTokenType(this.EntityToken, helper);
            OnWriteType(this.EntityToken, helper);
            OnWriteSource(this.EntityToken, helper);
            OnWriteId(this.EntityToken, helper);

            var extraInfo = EntityToken.OnGetExtraPrettyHtml();
            if (!extraInfo.IsNullOrEmpty())
            {
                helper.AddFullRow(new[] { "<b>Extra</b>", extraInfo });
            }

            helper.AddHeading("<b>Custom Properties</b>");
            foreach (var kvp in _customProperties)
            {
                PropertyInfo propertyInfo = this.EntityToken.GetType().GetPropertiesRecursively().Single(f => f.Name == kvp.Key);
                kvp.Value(kvp.Key, propertyInfo.GetValue(this.EntityToken, null), helper);
            }


            helper.AddHeading("<b>Piggybag</b>");
            foreach (var kvp in this.PiggyBag)
            {
                OnPiggyBagEntry(kvp.Key, kvp.Value, helper);
            }

            helper.AddHeading("<b>SecurityAncestorProvider</b>");
            SecurityAncestorProviderAttribute attribute = this.EntityToken.GetType().GetCustomAttributesRecursively<SecurityAncestorProviderAttribute>().SingleOrDefault();
            OnWriteSecurityAncestorProvider(attribute, helper);


            helper.AddHeading("<b>AuxiliarySecurityAncestorProviders</b>");
            foreach (IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider in AuxiliarySecurityAncestorFacade.GetAuxiliaryAncestorProviders(this.EntityToken.GetType()))
            {
                OnWriteAuxiliarySecurityAncestorProvider(auxiliarySecurityAncestorProvider, helper);
            }

            helper.EndTable();

            return helper.GetResult();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string idString = Request.QueryString["Id"];
            if (string.IsNullOrEmpty(idString) == true)
            {
                return;
            }

            Guid id = new Guid(idString);
            string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format("{0}.RelationshipGraph", id));

            EntityToken startEntityToken = EntityTokenSerializer.Deserialize(C1File.ReadAllLines(filename)[0]);

            RelationshipOrientedGraph graph = new RelationshipOrientedGraph(startEntityToken);

            IEnumerable<IEnumerable<EntityToken>> paths = graph.Root.GetAllPaths();

            RelationshipOrientedGraphPlaceHolder.Controls.Add(new LiteralControl(string.Format("<div><b>Path count: {0}</b></div>", paths.Count())));

            int pathCounter = 1;
            foreach (IEnumerable<EntityToken> path in paths)
            {
                EntityTokenHtmlPrettyfierHelper helper = new EntityTokenHtmlPrettyfierHelper();
                helper.StartTable();

                helper.AddHeading(string.Format("<b>Path: {0}</b>", pathCounter++));

                int levelCounter = 0;
                foreach (EntityToken entityToken in path)
                {
                    helper.StartRow();
                    helper.AddCell(string.Format("<center><b>Level: {0}</b></center>", levelCounter++), 2, "#aaaaaa");
                    helper.EndRow();

                    helper.StartRow();
                    helper.AddCell("<b>Id</b>");
                    helper.AddCell(entityToken.OnGetIdPrettyHtml());
                    helper.EndRow();

                    helper.StartRow();
                    helper.AddCell("<b>Type</b>");
                    helper.AddCell(entityToken.OnGetTypePrettyHtml());
                    helper.EndRow();

                    helper.StartRow();
                    helper.AddCell("<b>Source</b>");
                    helper.AddCell(entityToken.OnGetSourcePrettyHtml());
                    helper.EndRow();

                    string extra = entityToken.OnGetExtraPrettyHtml();
                    if (string.IsNullOrEmpty(extra) == false)
                    {
                        helper.StartRow();
                        helper.AddCell("<b>Extra</b>");
                        helper.AddCell(extra);
                        helper.EndRow();
                    }

                    helper.StartRow();
                    helper.AddCell("<b>RTT</b>");
                    helper.AddCell(TypeManager.SerializeType(entityToken.GetType()));
                    helper.EndRow();
                }

                helper.EndTable();

                RelationshipOrientedGraphPlaceHolder.Controls.Add(new LiteralControl(helper.GetResult()));
            }
        }