/// <summary> /// Execute the column family operation against the connection to the server. /// </summary> /// <typeparam name="TResult"></typeparam> /// <param name="action"></param> /// <param name="throwOnError"></param> /// <returns></returns> public TResult ExecuteOperation <TResult>(ColumnFamilyOperation <TResult> action, bool?throwOnError = null) { CassandraSession _localSession = null; if (CassandraSession.Current == null) { _localSession = new CassandraSession(); } try { LastError = null; TResult result; action.ColumnFamily = this; bool success = action.TryExecute(out result); if (!success) { LastError = action.Error; } if (!success && (throwOnError ?? ThrowErrors)) { throw action.Error; } return(result); } finally { if (_localSession != null) { _localSession.Dispose(); } } }
/// <summary> /// Execute the column family operation against the connection to the server. /// </summary> /// <typeparam name="TResult"></typeparam> /// <param name="action"></param> /// <param name="throwOnError"></param> /// <returns></returns> public TResult ExecuteOperation <TResult>(ColumnFamilyOperation <TResult> action, bool?throwOnError = null) { action.ColumnFamily = this; return(_context.ExecuteOperation(action, throwOnError)); }