protected virtual IResult Execute(IStatementBuilder statement)
 {
     try
     {
         return _dataContext.Execute(statement);
     }
     catch (Exception ex)
     {
         _logger.Exception(statement.ToString(), ex, "sql");
         throw;
     }
 }
 protected virtual IResult CacheExecute(IStatementBuilder statement, TimeSpan duration)
 {
     try
     {
         return _dataContext.CacheExecute(statement, duration);
     }
     catch (Exception ex)
     {
         _logger.Exception(statement.ToString(), ex, "sql;cache");
         throw;
     }
 }
Example #3
0
 public IResult CacheExecute(IStatementBuilder statement, TimeSpan duration)
 {
     if (statement.Type == QueryType.Delete || statement.Type == QueryType.Update || statement.Type == QueryType.Insert)
     {
         throw new System.Exception("Cache cannot be used with insert, update or delete query");
     }
     else
     {
         string cacheKey = statement.ToString();
         return _cacheService.Get(cacheKey, statement, Execute, duration);
     }
 }
 protected virtual IResult CacheExecute(IStatementBuilder statement, Func<string, IResult, bool> expirationCallback)
 {
     try
     {
         return _dataContext.CacheExecute(statement, expirationCallback);
     }
     catch (Exception ex)
     {
         _logger.Exception(statement.ToString(), ex, "sql;cache");
         throw;
     }
 }
Example #5
0
 public IResult CacheExecute(IStatementBuilder statement, Func<string, IResult, bool> expirationCallback)
 {
     if (statement.Type == QueryType.Delete || statement.Type == QueryType.Update || statement.Type == QueryType.Insert)
     {
         throw new System.Exception("Cache cannot be used with insert, update or delete query");
     }
     else
     {
         string cacheKey = statement.ToString();
         return _cacheService.Get(cacheKey, statement, expirationCallback, Execute);
     }
 }