示例#1
0
        /// <summary>
        /// Used to describe the "where" conditions of the join itself
        /// </summary>
        /// <param name="items"></param>
        /// <returns></returns>
        public esDynamicQuery On(params object[] items)
        {
            if (this.data.WhereItems == null)
            {
                this.data.WhereItems = new List <esComparison>();
            }

            foreach (object item in items)
            {
                esComparison wi = item as esComparison;

                if (wi != null)
                {
                    if (wi.data.WhereExpression != null)
                    {
                        foreach (esComparison exp in wi.data.WhereExpression)
                        {
                            esDynamicQuery q = exp.Value as esDynamicQuery;

                            if (q != null)
                            {
                                IDynamicQueryInternal iQ = q as IDynamicQueryInternal;
                                iQ.HookupProviderMetadata(q);
                            }
                        }

                        this.data.WhereItems.AddRange(wi.data.WhereExpression);
                    }
                    else
                    {
                        this.data.WhereItems.Add(wi);
                    }

                    esDynamicQuery query = wi.Value as esDynamicQuery;

                    if (query != null)
                    {
                        IDynamicQueryInternal iQ = query as IDynamicQueryInternal;
                        iQ.HookupProviderMetadata(query);
                    }
                }
                else
                {
                    throw new Exception("Unsupported Join Syntax");
                }
            }

            return(this.parentQuery);
        }
示例#2
0
        public esCase When(esComparison comparison)
        {
            this.WhenItem             = new esExpressionOrComparison();
            this.WhenItem.Comparisons = new List <esComparison>();

            if (comparison != null)
            {
                if (comparison.data.WhereExpression != null)
                {
                    foreach (esComparison exp in comparison.data.WhereExpression)
                    {
                        esDynamicQuery q = exp.Value as esDynamicQuery;

                        if (q != null)
                        {
                            IDynamicQueryInternal iQ = q as IDynamicQueryInternal;
                            iQ.HookupProviderMetadata(q);
                        }
                    }

                    this.WhenItem.Comparisons.AddRange(comparison.data.WhereExpression);
                }
                else
                {
                    this.WhenItem.Comparisons.Add(comparison);
                }

                esDynamicQuery query = comparison.Value as esDynamicQuery;

                if (query != null)
                {
                    IDynamicQueryInternal iQ = query as IDynamicQueryInternal;
                    iQ.HookupProviderMetadata(query);
                }
            }

            return(this);
        }