Srini-komman / dapper-dot-net

Automatically exported from code.google.com/p/dapper-dot-net
Other
0 stars 0 forks source link

Support all operators in SqlBuilder #78

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. while(aCondition) {SqlBuilder.Where("p = @p", new {...});}

What is the expected output? What do you see instead?
Would like RawSql to show the where conditions concatenated with OR.
RawSql shows that the where conditions are concatenated with AND.

What version of the product are you using? On what operating system?
Latest as of 2012/01/09

Please provide any additional information below.
File: SqlMapperExtensions.cs

Maybe add an enum to populate the operator?

    public enum ConcatOperator
    {
        AND,
        OR
    }

    public SqlBuilder Where(string sql, dynamic parameters = null, ConcatOperator concatOperator = ConcatOperator.AND)
    {
        AddClause("where", sql, parameters, " " + Enum.GetName(typeof(ConcatOperator), concatOperator) + " ", prefix: "WHERE ", postfix: "\n");
        return this;
    }

Original issue reported on code.google.com by Nick...@gmail.com on 9 Jan 2012 at 5:18