예제 #1
0
        private static void SetClassPath(this GraphMap graphMap, ClassMap parentClassMap)
        {
            if (parentClassMap.path == null)
            {
                parentClassMap.path = "";
            }

            ClassTemplateMap ctm = graphMap.classTemplateMaps.SingleOrDefault(x => x.classMap.id == parentClassMap.id && x.classMap.index == parentClassMap.index);

            if (ctm != null)
            {
                ctm.classMap.path = parentClassMap.path;
                foreach (TemplateMap tm in ctm.templateMaps)
                {
                    foreach (RoleMap rm in tm.roleMaps.Where(x => x.classMap != null))
                    {
                        rm.classMap.path = string.Format("{0}/{1}/{2}({3})/{4}", ctm.classMap.path, ctm.classMap.id, tm.id, tm.index, rm.id).Trim('/');

                        SetClassPath(graphMap, rm.classMap);
                    }
                }
            }
        }
예제 #2
0
        public static void AddClassMap(this GraphMap graphMap, RoleMap roleMap, ClassMap classMap)
        {
            ClassTemplateMap ctm = graphMap.GetClassTemplateMap(classMap.id, classMap.index);

            if (ctm == null)
            {
                graphMap.classTemplateMaps.Add(
                    new ClassTemplateMap
                {
                    classMap     = classMap,
                    templateMaps = new TemplateMaps()
                }
                    );
            }
            else
            {
                ctm.classMap = classMap;
            }

            if (roleMap != null)
            {
                roleMap.classMap = classMap;
            }
        }
예제 #3
0
        public static string BuildClassPath(this GraphMap graphMap, ClassMap parentClassMap, TemplateMap templateMap, RoleMap roleMap)
        {
            string path = string.Format("{0}/{1}/{2}({3})/{4}", parentClassMap.path, parentClassMap.id, templateMap.id, templateMap.index, roleMap.id).Trim('/');

            return(path);
        }