c# - DbExtensions - Cannot Manipulate SqlBuilder -


i have existing sqlbuilder, looks this

var query = sql     .where("field1 = {0}", "bob"); 

now want pass sqlbuilder function, can manipulated, select, , additional clauses can added it, doesnt seem possible?

if pass sqlbuilder function , call .select so

public void myfunction(sqlbuilder sqlbuilder) {     var newbuilder = sqlbuilder.clone()         .select("*")         .from("mytable")         .where("field2 = {0}", "something"); } 

now expect sql like

select * mytable field1 = 'bob' , field2 = 'something' 

but instead sql equal to

where field1 = 'bob' select * mytable field2 = 'something' 

obviously invalid. how can want? not possible dbextensions?

as said, manipulate existing sqlbuilder (clone first) , add additional clauses it. have add each clause in order? thought hold each in sort of background dictionary until needed create sql string?

with sqlbuilder, order matters, stringbuilder. have either adapt code, or use sqlset instead.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -