shps951023/DbSqlHelper

Add SqlFormat to format ParameterPrefix,QuotePrefix,QuoteSuffix easily

shps951023 opened this issue · 1 comments

e.g

            using (var cn = Db.GetConnection())
            {
                var result = Db.SqlFormat("select * from {1}orders{2} where id = {0}id");
                Assert.Equal("select * from [orders] where id = @id", result);
            }

Version 0.9.6

  • Add SqlFormat , e.g:
var sql = Db.SqlFormat("select * from {1}orders{2} where id = {0}id");
//if db is sqlserver
Assert.Equal("select * from [orders] where id = @id", sql);

//if db is oracle
Assert.Equal("select * from \"orders\" where id = :id", sql);