string Generate(DirectDatabaseCriterion criterion) { // Add the params: if (criterion.Parameters != null) { foreach (var x in criterion.Parameters) { Query.Parameters.Add(x.Key, x.Value); } } if (criterion.PropertyName.IsEmpty() || criterion.PropertyName == "N/A") { return(criterion.SqlCriteria); } return(criterion.SqlCriteria.Replace($"{{{{{criterion.PropertyName}}}}}", Query.Column(criterion.PropertyName))); }
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 SqlCriterionGenerator(query); foreach (var c in query.Criteria) { r.Append(whereGenerator.Generate(c).WithPrefix(" AND ")); } return(r.ToString()); }