示例#1
0
        /// <summary>
        /// Resolve a path into zero or one reference.
        /// </summary>
        /// Resolution into a reference is done in the in-memory
        /// document structure, and does not call into the database.
        /// <exception cref="AmbiguousPathException"></exception>
        internal Reference ResolveOne(Path.Path path, Reference context)
        {
            List <Reference> resolved = path.Resolve(context, _resolver);

            switch (resolved.Count)
            {
            case 0:
                return(null);

            case 1:
                return(resolved[0]);

            default:
                throw new AmbiguousPathException(
                          $"Path resolves to {resolved.Count} objects",
                          path.ToString(), context.ToString(), path.LineNumber, path.LinePosition);
            }
        }
示例#2
0
 /// <summary>
 /// Resolve a path into zero or more references. The
 /// returned list is sorted by ordinal.
 /// </summary>
 /// Resolution into a reference is done in the in-memory
 /// document structure, and does not call into the database.
 internal List <Reference> ResolveMany(Path.Path path, Reference context)
 {
     return(path.Resolve(context, _resolver));
 }