Beispiel #1
0
        public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
        {
            List <TypedValue> tv = new List <TypedValue>();

            tv.AddRange(criterion.GetTypedValues(criteria, criteriaQuery));
            tv.AddRange(whenTrue.GetTypedValues(criteria, criteriaQuery));
            tv.AddRange(whenFalse.GetTypedValues(criteria, criteriaQuery));
            return(tv.ToArray());
        }
        public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
        {
            if (_projection != null)
            {
                return(_projection.GetTypedValues(criteria, criteriaQuery));
            }

            return(new TypedValue[] { criteriaQuery.GetTypedIdentifierValue(criteria, value) });
        }
Beispiel #3
0
        public TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
        {
            if (projection != null)
            {
                return(projection.GetTypedValues(criteria, criteriaQuery));
            }

            return(new TypedValue[0]);            // not using parameters for ORDER BY columns
        }
        public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
        {
            if (projection != null)
            {
                return(projection.GetTypedValues(criteria, criteriaQuery));
            }

            return(base.GetTypedValues(criteria, criteriaQuery));
        }
Beispiel #5
0
        public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
        {
            var list = GetParameterTypedValues(criteria, criteriaQuery);

            if (_projection != null)
            {
                list.InsertRange(0, _projection.GetTypedValues(criteria, criteriaQuery));
            }

            return(list.ToArray());
        }
Beispiel #6
0
        public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
        {
            var typedValues = new List <TypedValue>();

            if (_projection != null)
            {
                typedValues.AddRange(_projection.GetTypedValues(criteria, criteriaQuery));
            }
            typedValues.Add(GetParameterTypedValue(criteria, criteriaQuery));

            return(typedValues.ToArray());
        }
Beispiel #7
0
        public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
        {
            var typedValues = new List <TypedValue>();

            foreach (var projectionCase in _cases)
            {
                typedValues.AddRange(projectionCase.Criterion.GetTypedValues(criteria, criteriaQuery));
                typedValues.AddRange(projectionCase.Projection.GetTypedValues(criteria, criteriaQuery));
            }

            typedValues.AddRange(_elseProjection.GetTypedValues(criteria, criteriaQuery));

            return(typedValues.ToArray());
        }
Beispiel #8
0
        public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
        {
            List <TypedValue> list = new List <TypedValue>();
            IType             type;

            if (_projection == null)
            {
                type = criteriaQuery.GetTypeUsingProjection(criteria, _propertyName);
            }
            else
            {
                IType[] types = _projection.GetTypes(criteria, criteriaQuery);
                if (types.Length != 1)
                {
                    throw new QueryException("Cannot use projections that return more than a single column with InExpression");
                }
                type = types[0];
                list.AddRange(_projection.GetTypedValues(criteria, criteriaQuery));
            }

            if (type.IsComponentType)
            {
                IAbstractComponentType actype = (IAbstractComponentType)type;
                IType[] types = actype.Subtypes;

                for (int i = 0; i < types.Length; i++)
                {
                    for (int j = 0; j < _values.Length; j++)
                    {
                        object subval = _values[j] == null
                                                                        ?
                                        null
                                                                        :
                                        actype.GetPropertyValues(_values[j], EntityMode.Poco)[i];
                        list.Add(new TypedValue(types[i], subval, EntityMode.Poco));
                    }
                }
            }
            else
            {
                for (int j = 0; j < _values.Length; j++)
                {
                    list.Add(new TypedValue(type, _values[j], EntityMode.Poco));
                }
            }

            return(list.ToArray());
        }
Beispiel #9
0
        public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
        {
            List <TypedValue> typedValues = new List <TypedValue>();

            if (projection != null)
            {
                typedValues.AddRange(projection.GetTypedValues(criteria, criteriaQuery));
                typedValues.AddRange(CriterionUtil.GetTypedValues(criteriaQuery, criteria, projection, null, value.ToString().ToLower()));
            }
            else
            {
                typedValues.Add(criteriaQuery.GetTypedValue(criteria, propertyName, value.ToString().ToLower()));
            }

            return(typedValues.ToArray());
        }
Beispiel #10
0
 public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
 {
     if (_lhsProjection == null && _rhsProjection == null)
     {
         return(NoTypedValues);
     }
     else
     {
         List <TypedValue> types = new List <TypedValue>();
         if (_lhsProjection != null)
         {
             types.AddRange(_lhsProjection.GetTypedValues(criteria, criteriaQuery));
         }
         if (_rhsProjection != null)
         {
             types.AddRange(_rhsProjection.GetTypedValues(criteria, criteriaQuery));
         }
         return(types.ToArray());
     }
 }
Beispiel #11
0
        public static TypedValue[] GetTypedValues(ICriteriaQuery criteriaQuery, ICriteria criteria,
            IProjection projection,
            string propertyName,
            params object[] values)
        {
            List<TypedValue> types = new List<TypedValue>();
            if (projection == null)
            {
                foreach (object value in values)
                {
                    TypedValue typedValue = criteriaQuery.GetTypedValue(criteria, propertyName, value);
                    types.Add(typedValue);
                }
            }
            else
            {
                TypedValue[] typedValues = projection.GetTypedValues(criteria, criteriaQuery);
                types.AddRange(typedValues);
                // we add the values collection _twice_ on purpose.
                // once is for the projection types, if they exists
                // the second for the parameters of the expression itself
                // if the projection is using no types, we will try to guess
                // what we have here
                foreach (object value in values)
                {
                    if (typedValues.Length != 0)
                    {
                        types.AddRange(typedValues);
                    }
                    else
                    {
                        types.Add(new TypedValue(NHibernateUtil.GuessType((object)value), value, EntityMode.Poco));
                    }
                }

            }
            return types.ToArray();
        }
Beispiel #12
0
 /// <summary>
 /// Gets the typed values for parameters in this projection
 /// </summary>
 /// <param name="criteria">The criteria.</param>
 /// <param name="criteriaQuery">The criteria query.</param>
 /// <returns></returns>
 public TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
 {
     return(projection.GetTypedValues(criteria, criteriaQuery));
 }
 public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
 {
     return(_projection == null ? NoValues : _projection.GetTypedValues(criteria, criteriaQuery));
 }
Beispiel #14
0
 public override NHibernate.Engine.TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
 {
     return(projection.GetTypedValues(criteria, criteriaQuery));
 }
Beispiel #15
0
 public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery)
 {
     return(_value.GetTypedValues(criteria, criteriaQuery));
 }