public override int Go() { if (string.IsNullOrWhiteSpace(ProcedureName)) { throw new MissingProcedureNameException(); } var name = "[" + SchemaName + "].[" + ProcedureName + "]"; return(ParameterDefinitions.Any() ? StatementExecutor.ExecuteNonQueryStoredProcedure(name, ParameterDefinitions.ToArray()) : StatementExecutor.ExecuteNonQueryStoredProcedure(name)); }
public override IEnumerable <TEntity> Go() { if (string.IsNullOrWhiteSpace(ProcedureName)) { ProcedureName = CustomAttributeHandle.DbTableName <TEntity>(); } if (string.IsNullOrWhiteSpace(ProcedureName)) { throw new MissingProcedureNameException(); } var name = "[" + SchemaName + "].[" + ProcedureName + "]"; using (var reader = ParameterDefinitions.Any() ? StatementExecutor.ExecuteStoredProcedure(name, ParameterDefinitions.ToArray()) : StatementExecutor.ExecuteStoredProcedure(name)) return(_entityMapper.Map <TEntity>(reader)); }
public override async Task <int> GoAsync() { if (string.IsNullOrWhiteSpace(ProcedureName)) { throw new MissingProcedureNameException(); } var procedureName = "[" + SchemaName + "].[" + ProcedureName + "]"; int num; if (ParameterDefinitions.Any()) { num = await StatementExecutor.ExecuteNonQueryStoredProcedureAsync(procedureName, ParameterDefinitions.ToArray()); } else { num = await StatementExecutor.ExecuteNonQueryStoredProcedureAsync(procedureName); } return(num); }
public override async Task <IEnumerable <TEntity> > GoAsync() { if (string.IsNullOrWhiteSpace(ProcedureName)) { ProcedureName = CustomAttributeHandle.DbTableName <TEntity>(); } if (string.IsNullOrWhiteSpace(ProcedureName)) { throw new MissingProcedureNameException(); } var procedureName = "[" + SchemaName + "].[" + ProcedureName + "]"; IDataReader dataReader; if (ParameterDefinitions.Any()) { dataReader = await StatementExecutor.ExecuteStoredProcedureAsync(procedureName, ParameterDefinitions.ToArray()); } else { dataReader = await StatementExecutor.ExecuteStoredProcedureAsync(procedureName); } var reader = dataReader; dataReader = null; IEnumerable <TEntity> entities; try { entities = entityMapper.Map <TEntity>(reader); } finally { reader?.Dispose(); } return(entities); }