Пример #1
0
        /// <summary>
        /// Returns a tree node that is representative of an entity or.
        /// </summary>
        /// <param name="context">Context information about this query building session, including the target structured query object.</param>
        /// <param name="allowReuse">A dedicated node should be returned because the caller intends on disturbing it.</param>
        /// <returns>A query node that can be used within the query.</returns>
        public override SQ.Entity OnBuildQueryNode(QueryBuilderContext context, bool allowReuse)
        {
            SQ.Entity result = context.ResolveParameterNode(ParameterName);

            AddChildNodes(context, result, allowReuse);

            return(result);
        }
Пример #2
0
 protected void AddChildNodes(QueryBuilderContext context, SQ.Entity parent, bool allowReuse)
 {
     context.ParentNodeStack.Push(parent);
     foreach (var node in ChildContainer.ChildEntityNodes)
     {
         node.BuildQueryNode(context, allowReuse);
     }
     context.ParentNodeStack.Pop();
 }
Пример #3
0
        /// <summary>
        /// Return true if we cannot
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        private static bool NodeMightCauseSomeRowsToNotAppear(SQ.Entity node)
        {
            // Check flags on the node
            RelatedResource relNode = node as RelatedResource;

            if (relNode != null)
            {
                if (relNode.ResourceMustExist || relNode.CheckExistenceOnly || relNode.ConstrainParent)
                {
                    return(true);
                }
            }
            else
            {
                DownCastResource derivedNode = node as DownCastResource;
                if (derivedNode != null)
                {
                    if (derivedNode.MustExist)
                    {
                        return(true);
                    }
                }
                else
                {
                    if (node is AggregateEntity)
                    {
                        return(false);   // aggregates will always give us something
                    }
                    else
                    {
                        return(true);
                    }
                }
            }

            // Check children
            if (node.RelatedEntities.Any(NodeMightCauseSomeRowsToNotAppear))
            {
                return(true);
            }

            return(false);
        }