DynamicSQL は、ORMでよく見る2way SQLのParser部分だけを切り出した軽量のライブラリです。
DynamicSQL is a lightweight library of 2way SQL Parser.

How to use
'set sql string
Dim sql As String = "select * from employee where age = /*ds age*/30"

'create parameter dictionary
Dim dic As New Dictionary(Of String, Object)
dic.Add("age", 30)

'create connection
Dim cn As IDbConnection = New SqlClient.SqlConnection("Data Source=localhost\SQLEXPRESS;")

'parse 2way-sql and create command
Dim cmd As IDbCommand = DSQLParser.CreateDbCommand(cn, sql, "@", dic)

'select * from employee where age = @age

'Name=age, Value=30

//set sql string
string sql = "select * from employee where age = /*ds age*/30";

//create parameter dictionary
Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("age", 30);

//create connection
IDbConnection cn = new System.Data.SqlClient.SqlConnection("Data Source=localhost\SQLEXPRESS;");

//parse 2way-sql and create command
IDbCommand cmd = DSQLParser.CreateDbCommand(cn, sql, "@", dic);

//select * from employee where age = @age

//Name=age, Value=30


Last edited Sep 9, 2014 at 3:02 PM by mk3008, version 6