public static void DeleteRoleMap(this GraphMap graphMap, TemplateMap templateMap, string roleId) { RoleMap roleMap = templateMap.roleMaps.Where(c => c.id == roleId).FirstOrDefault(); if (roleMap != null) { if (roleMap.classMap != null) { graphMap.DeleteClassMap(roleMap.classMap.id, roleMap.classMap.index); roleMap.value = null; roleMap.classMap = null; } } }
public static void DeleteClassMap(this GraphMap graphMap, string classId, int classIndex) { ClassTemplateMap classTemplateMap = graphMap.GetClassTemplateMap(classId, classIndex); if (classTemplateMap != null && classTemplateMap.classMap != null) { List <TemplateMap> templateMaps = classTemplateMap.templateMaps; foreach (TemplateMap templateMap in templateMaps) { RoleMap classRole = templateMap.roleMaps.Where(c => c.classMap != null).FirstOrDefault(); if (classRole != null) { graphMap.DeleteClassMap(classRole.classMap.id, classRole.classMap.index); classRole.classMap = null; } } templateMaps.Clear(); graphMap.classTemplateMaps.Remove(classTemplateMap); } //RearrangeClassMapIndex(graphMap, classId); }