@@ -18,7 +18,7 @@ public class DbScripts : ScriptMethods
18
18
private IDbConnectionFactory dbFactory ;
19
19
public IDbConnectionFactory DbFactory
20
20
{
21
- get => dbFactory ?? ( dbFactory = Context . Container . Resolve < IDbConnectionFactory > ( ) ) ;
21
+ get => dbFactory ??= Context . Container . Resolve < IDbConnectionFactory > ( ) ;
22
22
set => dbFactory = value ;
23
23
}
24
24
@@ -197,4 +197,91 @@ public ColumnSchema[] dbColumns(ScriptScopeContext scope, string tableName, obje
197
197
198
198
private string padCondition ( string text ) => string . IsNullOrEmpty ( text ) ? "" : " " + text ;
199
199
}
200
+
201
+ public partial class DbScriptsAsync
202
+ {
203
+ private static DbScripts Sync = new DbScripts ( ) ;
204
+
205
+ public object dbSelectSync ( ScriptScopeContext scope , string sql ) => Sync . dbSelect ( scope , sql ) ;
206
+
207
+ public object dbSelectSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args ) =>
208
+ Sync . dbSelect ( scope , sql , args ) ;
209
+
210
+ public object dbSelectSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
211
+ Sync . dbSelect ( scope , sql , args , options ) ;
212
+
213
+
214
+ public object dbSingleSync ( ScriptScopeContext scope , string sql ) =>
215
+ Sync . dbSingle ( scope , sql ) ;
216
+
217
+ public object dbSingleSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args ) =>
218
+ Sync . dbSingle ( scope , sql , args ) ;
219
+
220
+ public object dbSingleSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
221
+ Sync . dbSingle ( scope , sql , args , options ) ;
222
+
223
+
224
+ public object dbScalarSync ( ScriptScopeContext scope , string sql ) =>
225
+ Sync . dbScalar ( scope , sql ) ;
226
+
227
+ public object dbScalarSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args ) =>
228
+ Sync . dbScalar ( scope , sql , args ) ;
229
+
230
+ public object dbScalarSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
231
+ Sync . dbScalar ( scope , sql , args , options ) ;
232
+
233
+
234
+ public long dbCountSync ( ScriptScopeContext scope , string sql ) =>
235
+ Sync . dbCount ( scope , sql ) ;
236
+
237
+ public long dbCountSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args ) =>
238
+ Sync . dbCount ( scope , sql , args ) ;
239
+
240
+ public long dbCountSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
241
+ Sync . dbCount ( scope , sql , args , options ) ;
242
+
243
+
244
+ public bool dbExistsSync ( ScriptScopeContext scope , string sql ) =>
245
+ Sync . dbExists ( scope , sql ) ;
246
+
247
+ public bool dbExistsSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args ) =>
248
+ Sync . dbExists ( scope , sql , args ) ;
249
+
250
+ public bool dbExistsSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
251
+ Sync . dbExists ( scope , sql , args , options ) ;
252
+
253
+
254
+ public int dbExecSync ( ScriptScopeContext scope , string sql ) =>
255
+ Sync . dbExec ( scope , sql ) ;
256
+
257
+ public int dbExecSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args ) =>
258
+ Sync . dbExec ( scope , sql , args ) ;
259
+
260
+ public int dbExecSync ( ScriptScopeContext scope , string sql , Dictionary < string , object > args , object options ) =>
261
+ Sync . dbExec ( scope , sql , args , options ) ;
262
+
263
+ public List < string > dbTableNamesSync ( ScriptScopeContext scope ) => dbTableNamesSync ( scope , null , null ) ;
264
+ public List < string > dbTableNamesSync ( ScriptScopeContext scope , Dictionary < string , object > args ) => dbTableNamesSync ( scope , args , null ) ;
265
+ public List < string > dbTableNamesSync ( ScriptScopeContext scope , Dictionary < string , object > args , object options ) =>
266
+ Sync . dbTableNames ( scope , args , options ) ;
267
+
268
+ public List < KeyValuePair < string , long > > dbTableNamesWithRowCountsSync ( ScriptScopeContext scope ) =>
269
+ dbTableNamesWithRowCountsSync ( scope , null , null ) ;
270
+ public List < KeyValuePair < string , long > > dbTableNamesWithRowCountsSync ( ScriptScopeContext scope , Dictionary < string , object > args ) =>
271
+ dbTableNamesWithRowCountsSync ( scope , args , null ) ;
272
+ public List < KeyValuePair < string , long > > dbTableNamesWithRowCountsSync ( ScriptScopeContext scope , Dictionary < string , object > args , object options ) =>
273
+ Sync . dbTableNamesWithRowCounts ( scope , args , options ) ;
274
+
275
+ public string [ ] dbColumnNamesSync ( ScriptScopeContext scope , string tableName ) => dbColumnNamesSync ( scope , tableName , null ) ;
276
+ public string [ ] dbColumnNamesSync ( ScriptScopeContext scope , string tableName , object options ) =>
277
+ dbColumnsSync ( scope , tableName , options ) . Select ( x => x . ColumnName ) . ToArray ( ) ;
278
+
279
+ public ColumnSchema [ ] dbColumnsSync ( ScriptScopeContext scope , string tableName ) => dbColumnsSync ( scope , tableName , null ) ;
280
+ public ColumnSchema [ ] dbColumnsSync ( ScriptScopeContext scope , string tableName , object options ) =>
281
+ Sync . dbColumns ( scope , tableName , options ) ;
282
+
283
+ public ColumnSchema [ ] dbDescSync ( ScriptScopeContext scope , string sql ) => dbDescSync ( scope , sql , null ) ;
284
+ public ColumnSchema [ ] dbDescSync ( ScriptScopeContext scope , string sql , object options ) =>
285
+ Sync . dbDesc ( scope , sql , options ) ;
286
+ }
200
287
}
0 commit comments