This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
tests/ServiceStack.OrmLite.Tests Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -113,18 +113,19 @@ public void Can_execute_JoinSqlBuilder_as_SqlExpression()
113
113
[ Test ]
114
114
public void Can_execute_SqlBuilder_templates_as_SqlExpression ( )
115
115
{
116
- var sb = new SqlBuilder ( ) ;
117
-
118
- var tmpl = sb . AddTemplate ( "SELECT * FROM User u INNER JOIN Addresses a on a.UserId = u.Id /**where**/" ) ;
119
- sb . Where ( "Age > @age" , new { age = 18 } ) ;
120
- sb . Where ( "Countryalias = @country" , new { country = "Italy" } ) ;
121
-
122
-
123
116
using ( var db = OpenDbConnection ( ) )
124
117
{
125
118
db . DropAndCreateTable < User > ( ) ;
126
119
db . DropAndCreateTable < WithAliasAddress > ( ) ;
127
120
121
+ var sb = new SqlBuilder ( ) ;
122
+
123
+ var tmpl = sb . AddTemplate ( "SELECT * FROM {0} u INNER JOIN {1} a on a.{2} = u.Id /**where**/"
124
+ . Fmt ( "User" . SqlTable ( ) , "Addresses" . SqlTable ( ) , "UserId" . SqlColumn ( ) ) ) ;
125
+
126
+ sb . Where ( "Age > @age" , new { age = 18 } ) ;
127
+ sb . Where ( "Countryalias = @country" , new { country = "Italy" } ) ;
128
+
128
129
var userId = db . Insert ( new User { Age = 27 , Name = "Foo" } , selectIdentity : true ) ;
129
130
db . Insert ( new WithAliasAddress { City = "Rome" , Country = "Italy" , UserId = ( int ) userId } ) ;
130
131
You can’t perform that action at this time.
0 commit comments