public esCase When(object value)
        {
            this.WhenItem            = new esExpressionOrComparison();
            this.WhenItem.Expression = new esExpression();
            this.WhenItem.Expression.LiteralValue = value;

            return(this);
        }
        public esCase When(object value)
        {
            this.WhenItem = new esExpressionOrComparison();
            this.WhenItem.Expression = new esExpression();
            this.WhenItem.Expression.LiteralValue = value;

            return this;
        }
        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)
                    {
                        esDynamicQuerySerializable q = exp.Value as esDynamicQuerySerializable;

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

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

                esDynamicQuerySerializable query = comparison.Value as esDynamicQuerySerializable;

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

            return(this);
        }
        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)
                    {
                        esDynamicQuerySerializable q = exp.Value as esDynamicQuerySerializable;

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

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

                esDynamicQuerySerializable query = comparison.Value as esDynamicQuerySerializable;

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

            return this;
        }