|
| 1 | +using SmartSql.Abstractions; |
| 2 | +using System; |
| 3 | +using System.Collections.Generic; |
| 4 | +using System.Data; |
| 5 | +using System.Text; |
| 6 | +using System.Threading.Tasks; |
| 7 | + |
| 8 | +namespace SmartSql.DyRepository |
| 9 | +{ |
| 10 | + public static class RepositoryExtensions |
| 11 | + { |
| 12 | + public static void SessionWrap(this IRepository repository, Action handler) |
| 13 | + { |
| 14 | + repository.Session.SessionWrap(handler); |
| 15 | + } |
| 16 | + public static void SessionWrap(this IRepository repository, RequestContext context, Action handler) |
| 17 | + { |
| 18 | + repository.Session.SessionWrap(context, handler); |
| 19 | + } |
| 20 | + public static async Task SessionWrapAsync(this IRepository repository, Func<Task> handler) |
| 21 | + { |
| 22 | + await repository.Session.SessionWrapAsync(handler); |
| 23 | + } |
| 24 | + public static async Task SessionWrapAsync(this IRepository repository, RequestContext context, Func<Task> handler) |
| 25 | + { |
| 26 | + await repository.Session.SessionWrapAsync(context, handler); |
| 27 | + } |
| 28 | + public static void TransactionWrap(this IRepository repository, Action handler) |
| 29 | + { |
| 30 | + repository.Transaction.TransactionWrap(handler); |
| 31 | + } |
| 32 | + public static void TransactionWrap(this IRepository repository, IsolationLevel isolationLevel, Action handler) |
| 33 | + { |
| 34 | + repository.Transaction.TransactionWrap(isolationLevel, handler); |
| 35 | + } |
| 36 | + public static async Task TransactionWrapAsync(this IRepository repository, Func<Task> handler) |
| 37 | + { |
| 38 | + await repository.Transaction.TransactionWrapAsync(handler); |
| 39 | + } |
| 40 | + public static async Task TransactionWrapAsync(this IRepository repository, IsolationLevel isolationLevel, Func<Task> handler) |
| 41 | + { |
| 42 | + await repository.Transaction.TransactionWrapAsync(isolationLevel, handler); |
| 43 | + } |
| 44 | + } |
| 45 | +} |
0 commit comments