示例#1
0
 public static DatabaseObject ResolveReference(DatabaseObject context, string reference)
 {
     if (reference.Length == 36 && reference[8] == '-' && reference[13] == '-' && reference[18] == '-' && reference[23] == '-')
     {
         Guid guid = new Guid(reference);
         return(context.Database.FindDatabaseObject(guid, null, throwIfNotFound: false));
     }
     if (reference.Contains('/') || reference.Contains('.') || reference.Contains('^'))
     {
         string[] array = reference.Split(new char[1]
         {
             '/'
         }, StringSplitOptions.RemoveEmptyEntries);
         int num = 0;
         while (context != null && num < array.Length)
         {
             string text = array[num];
             if (!(text == "."))
             {
                 if (text == "..")
                 {
                     context = context.NestingParent;
                 }
                 else if (text.StartsWith("..."))
                 {
                     string text2 = text.Substring(3);
                     if (string.IsNullOrEmpty(text2))
                     {
                         context = context.NestingRoot;
                     }
                     else
                     {
                         while (context != null && context.Type.Name != text2)
                         {
                             context = context.NestingParent;
                         }
                     }
                 }
                 else if (text == "^^")
                 {
                     context = context.EffectiveInheritanceParent;
                 }
                 else
                 {
                     if (!text.StartsWith("^^^"))
                     {
                         return(context.FindEffectiveNestedChild(text, null, directChildrenOnly: true, throwIfNotFound: false));
                     }
                     string text3 = text.Substring(3);
                     if (string.IsNullOrEmpty(text3))
                     {
                         context = context.EffectiveInheritanceRoot;
                     }
                     else
                     {
                         while (context != null && context.Type.Name != text3)
                         {
                             context = context.EffectiveInheritanceParent;
                         }
                     }
                 }
             }
             num++;
         }
         return(context);
     }
     while (context != null)
     {
         DatabaseObject databaseObject = context.FindEffectiveNestedChild(reference, null, directChildrenOnly: true, throwIfNotFound: false);
         if (databaseObject != null)
         {
             return(databaseObject);
         }
         context = context.NestingParent;
     }
     return(null);
 }
示例#2
0
 public static void SaveDatabaseObject(XElement node, DatabaseObject databaseObject)
 {
     publicSaveDatabaseObject(node, databaseObject, saveNestingParent: false);
 }
示例#3
0
        public T GetNestedValue <T>(string name)
        {
            DatabaseObject databaseObject = FindEffectiveNestedChild(name, Type.NestedValueType, directChildrenOnly: true, throwIfNotFound: true);

            return(CastValue <T>(databaseObject));
        }