internal virtual async Task <T> ExecuteTranAsync <T>(Func <TransactionalDbContext, Task <T> > func)//dispose edilmil nesne' nin reader' ınu çağırmasın diye 'Task<IEnumerable<Role>>' yerine 'async Task<IEnumerable<Role>>' { T ret = default(T); if (null != func) { TransactionalDbContext db = null; try { db = this.CreateTransactionalDbContext(); ret = await func(db); db.Commit(); } catch (Exception ex) { _ = SQLog.Logger.Create(this.GetType().Name, nameof(Execute)) .Code(768) .Error(ex) .SaveAsync(); throw; } finally { db?.Dispose(); } } return(ret); }
internal virtual T ExecuteTran <T>(Func <TransactionalDbContext, T> func) { T ret = default(T); if (null != func) { TransactionalDbContext db = null; try { db = this.CreateTransactionalDbContext(); ret = func(db); db.Commit(); } catch (Exception ex) { SQLog.Logger.Create(this.GetType().Name, nameof(Execute)) .Code(766) .Error(ex) .SaveAsync(); throw; } finally { db?.Dispose(); } } return(ret); }