当前位置: 首页>>代码示例>>C#>>正文


C# EntityToken.GetHashCode方法代码示例

本文整理汇总了C#中Composite.C1Console.Security.EntityToken.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# EntityToken.GetHashCode方法的具体用法?C# EntityToken.GetHashCode怎么用?C# EntityToken.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composite.C1Console.Security.EntityToken的用法示例。


在下文中一共展示了EntityToken.GetHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrettyPrintEntityToken


//.........这里部分代码省略.........

            IEnumerable<PermissionType> currentPermissionTypes = PermissionTypeFacade.GetCurrentPermissionTypes(new UserToken(username), entityToken, PermissionTypeFacade.GetUserPermissionDefinitions(username), PermissionTypeFacade.GetUserGroupPermissionDefinitions(username));

            StringBuilder currentSb = new StringBuilder();
            foreach (PermissionType permissionType in currentPermissionTypes)
            {
                if (currentSb.ToString() != "")
                {
                    currentSb.Append(", ");
                }

                currentSb.Append(new PermissionDescriptor(permissionType).Label);
            }

            currentUsersPermisstionTypes.Add(new XElement("span", new XAttribute("style", "padding-left: 15px;"), string.Format("{0} = {1}", username, currentSb.ToString())));
            currentUsersPermisstionTypes.Add(new XElement("br"));
        }

        List<object> userGroupPermissionsDefinedHere = new List<object>();
        List<object> inheritedGroupPermissions = new List<object>();

        List<IUserGroup> userGroups = DataFacade.GetData<IUserGroup>().ToList();
        foreach (IUserGroup userGroup in userGroups)
        {
            IEnumerable<PermissionType> userGroupPermissionTypes = PermissionTypeFacade.GetLocallyDefinedUserGroupPermissionTypes(userGroup.Id, entityToken);

            StringBuilder sb = new StringBuilder();
            foreach (PermissionType permissionType in userGroupPermissionTypes)
            {
                if (sb.ToString() != "")
                {
                    sb.Append(", ");
                }

                sb.Append(new PermissionDescriptor(permissionType).Label);
            }

            userGroupPermissionsDefinedHere.Add(new XElement("span", new XAttribute("style", "padding-left: 15px;"), string.Format("{0} = {1}", userGroup.Name, sb.ToString())));
            userGroupPermissionsDefinedHere.Add(new XElement("br"));

            IEnumerable<PermissionType> inheritedUserGroupPermissionTypes = PermissionTypeFacade.GetInheritedGroupPermissionsTypes(userGroup.Id, entityToken);
            sb = new StringBuilder();
            foreach (PermissionType permissionType in inheritedUserGroupPermissionTypes)
            {
                if (sb.ToString() != "")
                {
                    sb.Append(", ");
                }

                sb.Append(new PermissionDescriptor(permissionType).Label);
            }

            inheritedGroupPermissions.Add(new XElement("span", new XAttribute("style", "padding-left: 15px;"), string.Format("{0} = {1}", userGroup.Name, sb.ToString())));
            inheritedGroupPermissions.Add(new XElement("br"));
        }

        XElement element =
            new XElement("div", new XAttribute("style", string.Format("border:2px; border-style: solid; border-color: {0}; margin-bottom: 2px; margin-left:5px; margin-right:5px; padding: 3px;", color)),
                new XElement("b", "Runtime type: "),
                entityToken.GetType().ToString(),
                new XElement("br"),
                new XElement("b", "Hashcode: "),
                entityToken.GetHashCode().ToString(),
                new XElement("br"),
                new XElement("b", "Source: "),
                entityToken.Source,
                new XElement("br"),
                new XElement("b", "Type: "),
                entityToken.Type,
                new XElement("br"),
                new XElement("b", "Id: "),
                idList,
                new XElement("br"),
                new XElement("b", "Serialized entity token: "),
                serializedEntityToken,
                new XElement("br"),

                new XElement("b", "Users permissions defined here: "),
                new XElement("br"),
                usersermisstionsDefinedHere,
                new XElement("br"),

                new XElement("b", "Current users permissions here: "),
                new XElement("br"),
                currentUsersPermisstionTypes,
                new XElement("br"),

                new XElement("b", "User group permissions defined here: "),
                new XElement("br"),
                userGroupPermissionsDefinedHere,
                new XElement("br"),

                new XElement("b", "Inherted user group permissions: "),
                new XElement("br"),
                inheritedGroupPermissions,
                new XElement("br")
            );

        RelationshipGraphHolder.Controls.Add(new LiteralControl(element.ToString()));
    }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:101,代码来源:Default.aspx.cs


注:本文中的Composite.C1Console.Security.EntityToken.GetHashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。