Example #1
0
        public virtual string GenerateWhere(IDatabaseQuery query)
        {
            var r = new StringBuilder();

            if (SoftDeleteAttribute.RequiresSoftdeleteQuery(query.EntityType))
            {
                query.Criteria.Add(new Criterion("IsMarkedSoftDeleted", false));
            }

            r.Append($" WHERE { query.Column("ID")} IS NOT NULL");

            foreach (var c in query.Criteria)
            {
                r.Append(Generate(query, c).WithPrefix(" AND "));
            }

            return(r.ToString());
        }
Example #2
0
        public override string GenerateWhere(DatabaseQuery query)
        {
            var r = new StringBuilder();

            if (SoftDeleteAttribute.RequiresSoftdeleteQuery(query.EntityType))
            {
                query.Criteria.Add(new Criterion("IsMarkedSoftDeleted", false));
            }

            r.Append($" WHERE { MapColumn("ID")} IS NOT NULL");

            var whereGenerator = new SqlCriterionGenerator(query);

            foreach (var c in query.Criteria)
            {
                r.Append(whereGenerator.Generate(c).WithPrefix(" AND "));
            }

            return(r.ToString());
        }
        public override string GenerateWhere(DatabaseQuery query)
        {
            var r = new StringBuilder();

            if (SoftDeleteAttribute.RequiresSoftdeleteQuery(query.EntityType))
            {
                query.Criteria.Add(new Criterion("IsMarkedSoftDeleted", false));
            }

            r.Append($" WHERE { query.Column("Id")} IS NOT NULL");

            var whereGenerator = new PostgreSqlCriterionGenerator(query);
            var temp           = new List <ICriterion>();

            foreach (var c in query.Criteria)
            {
                if (c.PropertyName == "ID")
                {
                    temp.Add(c);
                }
            }

            query.Criteria.RemoveAll(x => x.PropertyName == "ID");

            foreach (var c in temp)
            {
                query.Criteria.Add(new Criterion("Id", c.FilterFunction, c.Value));
            }

            foreach (var c in query.Criteria)
            {
                r.Append(whereGenerator.Generate(c).WithPrefix(" AND "));
            }

            return(r.ToString());
        }