Exemple #1
0
        private bool ContinuePathExpression(string token, QueryTranslator q)
        {
            expectingPathContinuation = false;

            PathExpressionParser.CollectionElement element = pathExpressionParser.LastCollectionElement();

            if (token.StartsWith("."))
            {                                                            // the path expression continues after a ]
                DoPathExpression(GetElementName(element, q) + token, q); // careful with this!

                AddToCurrentJoin(element);
                return(true);                //NOTE: EARLY EXIT!
            }
            else
            {
                // the path expression ends at the ]
                if (element.ElementColumns.Length != 1)
                {
                    throw new QueryException("path expression ended in composite collection element");
                }
                AppendToken(q, element.ElementColumns[0]);
                AddToCurrentJoin(element);
                return(false);
            }
        }
Exemple #2
0
        private string GetElementName(PathExpressionParser.CollectionElement element, QueryTranslator q)
        {
            string name;

            if (element.IsOneToMany)
            {
                name = element.Alias;
            }
            else
            {
                IType       type = element.Type;
                System.Type clazz;

                if (type.IsEntityType)
                {
                    //ie. a many-to-many
                    clazz = (( EntityType )type).AssociatedClass;
                    name  = pathExpressionParser.ContinueFromManyToMany(clazz, element.ElementColumns, q);
                }
                else
                {
                    throw new QueryException("illegally dereferenced collection element");
                }
            }
            return(name);
        }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="q"></param>
 public void End(QueryTranslator q)
 {
     if (expectingPathContinuation)
     {
         expectingPathContinuation = false;
         PathExpressionParser.CollectionElement element = pathExpressionParser.LastCollectionElement();
         if (element.ElementColumns.Length != 1)
         {
             throw new QueryException("path expression ended in composite collection element");
         }
         AppendToken(q, element.ElementColumns[0]);
         AddToCurrentJoin(element);
     }
     Token(StringHelper.ClosedParen, q);
 }
Exemple #4
0
 private void AddToCurrentJoin(PathExpressionParser.CollectionElement ce)
 {
     AddToCurrentJoin(ce.Join.ToWhereFragmentString + ce.IndexValue.ToString());
 }