Ejemplo n.º 1
0
        public void Not(Action <IHqlExpressionFactory> expression)
        {
            expression(this);
            var a = Criterion;

            Criterion = HqlRestrictions.Not(a);
        }
Ejemplo n.º 2
0
        public void Or(Action <IHqlExpressionFactory> lhs, Action <IHqlExpressionFactory> rhs)
        {
            lhs(this);
            var a = Criterion;

            rhs(this);
            var b = Criterion;

            Criterion = HqlRestrictions.Or(a, b);
        }
Ejemplo n.º 3
0
        public void Disjunction(Action <IHqlExpressionFactory> expression, params Action <IHqlExpressionFactory>[] otherExpressions)
        {
            var junction = HqlRestrictions.Disjunction();

            foreach (var exp in Enumerable.Empty <Action <IHqlExpressionFactory> >().Union(new[] { expression }).Union(otherExpressions))
            {
                exp(this);
                junction.Add(Criterion);
            }

            Criterion = junction;
        }
Ejemplo n.º 4
0
        public void InSubquery(string propertyName, string subquery, Dictionary <string, object> parameters)
        {
            string subqueryWithParameters = "";

            Regex re = new Regex(@"(?<![^\s]):[^\s]+");

            subqueryWithParameters = re.Replace(subquery, x => {
                object param;

                if (parameters.TryGetValue(x.ToString().TrimStart(':'), out param))
                {
                    var typeCode = Type.GetTypeCode(param.GetType());
                    switch (typeCode)
                    {
                    case TypeCode.String:
                    case TypeCode.DateTime:
                        return(HqlRestrictions.FormatValue(param));

                    case TypeCode.UInt16:
                    case TypeCode.UInt32:
                    case TypeCode.UInt64:
                    case TypeCode.Int16:
                    case TypeCode.Int32:
                    case TypeCode.Int64:
                    case TypeCode.Decimal:
                    case TypeCode.Double:
                        return(FormatNumber(param));

                    default:
                        return("");
                    }
                }

                return("");
            });

            Criterion = InSubquery(propertyName, subqueryWithParameters);
        }
Ejemplo n.º 5
0
 public void Between(string propertyName, object lo, object hi)
 {
     Criterion = HqlRestrictions.Between(propertyName, lo, hi);
 }
Ejemplo n.º 6
0
 public static IHqlCriterion And(IHqlCriterion lhs, IHqlCriterion rhs)
 {
     return(new CompositeHqlCriterion("and")
            .Add(lhs)
            .Add(rhs));
 }
Ejemplo n.º 7
0
 public CompositeHqlCriterion Add(IHqlCriterion criterion)
 {
     Criterions.Add(criterion);
     return(this);
 }
Ejemplo n.º 8
0
 public void IsNotNull(string propertyName)
 {
     Criterion = HqlRestrictions.IsNotNull(propertyName);
 }
Ejemplo n.º 9
0
 public void IsEmpty(string propertyName)
 {
     Criterion = HqlRestrictions.IsEmpty(propertyName);
 }
Ejemplo n.º 10
0
 public void InG <T>(string propertyName, ICollection <T> values)
 {
     Criterion = HqlRestrictions.InG(propertyName, values);
 }
Ejemplo n.º 11
0
 public void LeProperty(string propertyName, string otherPropertyName)
 {
     Criterion = HqlRestrictions.LeProperty(propertyName, otherPropertyName);
 }
Ejemplo n.º 12
0
 public void AllEq(IDictionary propertyNameValues)
 {
     Criterion = HqlRestrictions.AllEq(propertyNameValues);
 }
Ejemplo n.º 13
0
 public void Eq(string propertyName, object value)
 {
     Criterion = HqlRestrictions.Eq(propertyName, value);
 }
Ejemplo n.º 14
0
 public void Ge(string propertyName, object value)
 {
     Criterion = HqlRestrictions.Ge(propertyName, value);
 }
Ejemplo n.º 15
0
 public void InsensitiveLike(string propertyName, string value, HqlMatchMode matchMode)
 {
     Criterion = HqlRestrictions.InsensitiveLike(propertyName, value, matchMode);
 }
Ejemplo n.º 16
0
 public NotExpression(IHqlCriterion criterion)
 {
     Criterion = criterion;
 }
Ejemplo n.º 17
0
 public static IHqlCriterion Or(IHqlCriterion lhs, IHqlCriterion rhs)
 {
     return(new CompositeHqlCriterion("or")
            .Add(lhs)
            .Add(rhs));
 }
Ejemplo n.º 18
0
 public static IHqlCriterion Not(IHqlCriterion expression)
 {
     return(new NotExpression(expression));
 }
Ejemplo n.º 19
0
 public void NaturalId()
 {
     Criterion = HqlRestrictions.NaturalId();
 }
Ejemplo n.º 20
0
 public void In(string propertyName, object[] values)
 {
     Criterion = HqlRestrictions.In(propertyName, values);
 }