3
3
using System . Data ;
4
4
using System . Threading . Tasks ;
5
5
using ServiceStack . Data ;
6
- using ServiceStack . Templates ;
6
+ using ServiceStack . Script ;
7
7
8
8
namespace ServiceStack . OrmLite
9
9
{
10
- public class TemplateDbFiltersAsync : TemplateFilter
10
+ [ Obsolete ( "Use DbScriptsAsync" ) ]
11
+ public class TemplateDbFiltersAsync : DbScriptsAsync { }
12
+
13
+ public class DbScriptsAsync : ScriptMethods
11
14
{
12
15
private IDbConnectionFactory dbFactory ;
13
16
public IDbConnectionFactory DbFactory
@@ -16,7 +19,7 @@ public IDbConnectionFactory DbFactory
16
19
set => dbFactory = value ;
17
20
}
18
21
19
- public async Task < IDbConnection > OpenDbConnectionAsync ( TemplateScopeContext scope , Dictionary < string , object > options )
22
+ public async Task < IDbConnection > OpenDbConnectionAsync ( ScriptScopeContext scope , Dictionary < string , object > options )
20
23
{
21
24
if ( options != null )
22
25
{
@@ -35,7 +38,7 @@ public async Task<IDbConnection> OpenDbConnectionAsync(TemplateScopeContext scop
35
38
return await DbFactory . OpenAsync ( ) ;
36
39
}
37
40
38
- async Task < object > exec < T > ( Func < IDbConnection , Task < T > > fn , TemplateScopeContext scope , object options )
41
+ async Task < object > exec < T > ( Func < IDbConnection , Task < T > > fn , ScriptScopeContext scope , object options )
39
42
{
40
43
try
41
44
{
@@ -51,43 +54,43 @@ async Task<object> exec<T>(Func<IDbConnection, Task<T>> fn, TemplateScopeContext
51
54
}
52
55
}
53
56
54
- public Task < object > dbSelect ( TemplateScopeContext scope , string sql ) =>
57
+ public Task < object > dbSelect ( ScriptScopeContext scope , string sql ) =>
55
58
exec ( db => db . SqlListAsync < Dictionary < string , object > > ( sql ) , scope , null ) ;
56
59
57
- public Task < object > dbSelect ( TemplateScopeContext scope , string sql , Dictionary < string , object > args ) =>
60
+ public Task < object > dbSelect ( ScriptScopeContext scope , string sql , Dictionary < string , object > args ) =>
58
61
exec ( db => db . SqlListAsync < Dictionary < string , object > > ( sql , args ) , scope , null ) ;
59
62
60
- public Task < object > dbSelect ( TemplateScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
63
+ public Task < object > dbSelect ( ScriptScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
61
64
exec ( db => db . SqlListAsync < Dictionary < string , object > > ( sql , args ) , scope , options ) ;
62
65
63
66
64
- public Task < object > dbSingle ( TemplateScopeContext scope , string sql ) =>
67
+ public Task < object > dbSingle ( ScriptScopeContext scope , string sql ) =>
65
68
exec ( db => db . SingleAsync < Dictionary < string , object > > ( sql ) , scope , null ) ;
66
69
67
- public Task < object > dbSingle ( TemplateScopeContext scope , string sql , Dictionary < string , object > args ) =>
70
+ public Task < object > dbSingle ( ScriptScopeContext scope , string sql , Dictionary < string , object > args ) =>
68
71
exec ( db => db . SingleAsync < Dictionary < string , object > > ( sql , args ) , scope , null ) ;
69
72
70
- public Task < object > dbSingle ( TemplateScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
73
+ public Task < object > dbSingle ( ScriptScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
71
74
exec ( db => db . SingleAsync < Dictionary < string , object > > ( sql , args ) , scope , options ) ;
72
75
73
76
74
- public Task < object > dbScalar ( TemplateScopeContext scope , string sql ) =>
77
+ public Task < object > dbScalar ( ScriptScopeContext scope , string sql ) =>
75
78
exec ( db => db . ScalarAsync < object > ( sql ) , scope , null ) ;
76
79
77
- public Task < object > dbScalar ( TemplateScopeContext scope , string sql , Dictionary < string , object > args ) =>
80
+ public Task < object > dbScalar ( ScriptScopeContext scope , string sql , Dictionary < string , object > args ) =>
78
81
exec ( db => db . ScalarAsync < object > ( sql , args ) , scope , null ) ;
79
82
80
- public Task < object > dbScalar ( TemplateScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
83
+ public Task < object > dbScalar ( ScriptScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
81
84
exec ( db => db . ScalarAsync < object > ( sql , args ) , scope , options ) ;
82
85
83
86
84
- public Task < object > dbExec ( TemplateScopeContext scope , string sql ) =>
87
+ public Task < object > dbExec ( ScriptScopeContext scope , string sql ) =>
85
88
exec ( db => db . ExecuteSqlAsync ( sql ) , scope , null ) ;
86
89
87
- public Task < object > dbExec ( TemplateScopeContext scope , string sql , Dictionary < string , object > args ) =>
90
+ public Task < object > dbExec ( ScriptScopeContext scope , string sql , Dictionary < string , object > args ) =>
88
91
exec ( db => db . ExecuteSqlAsync ( sql , args ) , scope , null ) ;
89
92
90
- public Task < object > dbExec ( TemplateScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
93
+ public Task < object > dbExec ( ScriptScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
91
94
exec ( db => db . ExecuteSqlAsync ( sql , args ) , scope , options ) ;
92
95
93
96
0 commit comments