public Task <IDbTransaction> GetActiveTransactionAsync(ActiveTransactionProviderArgs args) { var adoTransaction = _sessionProvider.Session.GetCurrentTransaction().As <AdoTransaction>(); var dbTransaction = GetFieldValue(typeof(AdoTransaction), adoTransaction, "trans").As <IDbTransaction>(); return(Task.FromResult(dbTransaction)); }
public IDbTransaction GetActiveTransaction(ActiveTransactionProviderArgs args) { var adoTransaction = GetSession(args).Transaction.As <AdoTransaction>(); var dbTransaction = GetInstanceField(typeof(AdoTransaction), adoTransaction, "trans").As <IDbTransaction>(); return(dbTransaction); }
public IDbTransaction GetActiveTransaction(ActiveTransactionProviderArgs args) { var adoTransaction = _sessionProvider.Session.Transaction.As <AdoTransaction>(); var dbTransaction = GetFieldValue(typeof(AdoTransaction), adoTransaction, "trans").As <IDbTransaction>(); return(dbTransaction); }
public IDbConnection GetActiveConnection(ActiveTransactionProviderArgs args) { if (Session.Connection.State == ConnectionState.Closed) { Session.Connection.Close(); } return(Session.Connection); }
private DbContext GetDbContext(ActiveTransactionProviderArgs args) { var dbContextType = (Type)args["ContextType"]; Type dbContextProviderType = typeof(IDbContextProvider <>).MakeGenericType(dbContextType); object dbContextProvider = _scopeResolver.Resolve(dbContextProviderType); var dbContext = getDbContextMethod.Invoke(dbContextProvider, null).As <DbContext>(); return(dbContext); }
private ISession GetSession(ActiveTransactionProviderArgs args) { var sessionContextType = (Type)args["SessionContextType"]; var sessionContextProvider = _scope.Resolve <ISessionProvider>(); MethodInfo method = getSessionMethod.MakeGenericMethod(sessionContextType); var session = method.Invoke(sessionContextProvider, null).As <ISession>(); return(session); }
public IDbConnection GetActiveConnection(ActiveTransactionProviderArgs args) { var connection = DbFactory.CreateConnection(); connection.ConnectionString = DbContext.ConnectionString; if (connection.State != ConnectionState.Open) { connection.Open(); } return(connection); }
private DbContext GetDbContext(ActiveTransactionProviderArgs args) { Type dbContextProviderType = typeof(IDbContextProvider <>).MakeGenericType((Type)args["ContextType"]); using (IDisposableDependencyObjectWrapper dbContextProviderWrapper = _iocResolver.ResolveAsDisposable(dbContextProviderType)) { MethodInfo method = dbContextProviderWrapper.Object.GetType() .GetMethod("GetDbContext"); return((DbContext)method.Invoke(dbContextProviderWrapper.Object, new object[0])); } }
private DbContext GetDbContext(ActiveTransactionProviderArgs args) { var dbContextProviderType = typeof(IDbContextProvider <>).MakeGenericType((Type)args["ContextType"]); using (var dbContextProviderWrapper = iocResolver.ResolveAsDisposable(dbContextProviderType)) { var method = dbContextProviderWrapper.Object.GetType() .GetMethod( nameof(IDbContextProvider <StudioXDbContext> .GetDbContext), new[] { typeof(MultiTenancySides) } ); return((DbContext)method.Invoke( dbContextProviderWrapper.Object, new object[] { (MultiTenancySides?)args["MultiTenancySide"] } )); } }
private async Task <DbContext> GetDbContextAsync(ActiveTransactionProviderArgs args) { var dbContextProviderType = typeof(IDbContextProvider <>).MakeGenericType((Type)args["ContextType"]); using (var dbContextProviderWrapper = _iocResolver.ResolveAsDisposable(dbContextProviderType)) { var method = dbContextProviderWrapper.Object.GetType() .GetMethod( nameof(IDbContextProvider <AbpDbContext> .GetDbContextAsync), new[] { typeof(MultiTenancySides) } ); var result = await ReflectionHelper.InvokeAsync(method, dbContextProviderWrapper.Object, new object[] { (MultiTenancySides?)args["MultiTenancySide"] }); return(result as DbContext); } }
public async Task <IDbTransaction> GetActiveTransactionAsync(ActiveTransactionProviderArgs args) { var context = await GetDbContextAsync(args); return(context.Database.CurrentTransaction.UnderlyingTransaction); }
public IDbConnection GetActiveConnection(ActiveTransactionProviderArgs args) { return(GetDbContext(args).Database.Connection); }
public IDbTransaction GetActiveTransaction(ActiveTransactionProviderArgs args) { return(GetDbContext(args).Database.CurrentTransaction?.UnderlyingTransaction); }
public IDbConnection GetActiveConnection(ActiveTransactionProviderArgs args) { throw new NotImplementedException(); }
public IDbTransaction GetActiveTransaction(ActiveTransactionProviderArgs args) { return(Session.CurrentTransaction); }
public IDbConnection GetActiveConnection(ActiveTransactionProviderArgs args) { return(_sessionProvider.Session.Connection); }
public async Task <IDbConnection> GetActiveConnectionAsync(ActiveTransactionProviderArgs args) { return(await Task.FromResult(_sessionProvider.Session.Connection)); }
public async Task <IDbConnection> GetActiveConnectionAsync(ActiveTransactionProviderArgs args) { var context = await GetDbContextAsync(args); return(context.Database.GetDbConnection()); }
public IDbTransaction GetActiveTransaction(ActiveTransactionProviderArgs args) { //return GetActiveConnection(args).BeginTransaction(); return(null); }
public async Task <IDbTransaction> GetActiveTransactionAsync(ActiveTransactionProviderArgs args) { return(await Task.FromResult(GetActiveTransaction(args))); }
public ISession GetActiveSession(ActiveTransactionProviderArgs args) { EnsureSession(); return(_session); }
public IDbConnection GetActiveConnection(ActiveTransactionProviderArgs args) { return(conn); }
public IDbConnection GetActiveConnection(ActiveTransactionProviderArgs args) { var context = GetDbContext(args); return(context.Database.GetDbConnection()); }
public IDbTransaction GetActiveTransaction(ActiveTransactionProviderArgs args) { IDbTransaction dbTransaction = conn.BeginTransaction(); return(dbTransaction); }
public DbContext GetDbContext(ActiveTransactionProviderArgs args) { DbContext dbContext = (DbContext)DbContext; return(dbContext); }