Skip to content

Commit

Permalink
Make generic version of QueryWithRowMapper and QueryWithResultSetExtr…
Browse files Browse the repository at this point in the history
…actor virtual (#249)
  • Loading branch information
robsosno committed Jul 2, 2024
1 parent 4b86a88 commit 1f628dd
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ public virtual void QueryWithRowCallbackDelegate(CommandType cmdType, string sql

}

public void QueryWithRowCallbackDelegate(CommandType cmdType, string sql, RowCallbackDelegate rowCallbackDelegate, IDbParameters parameters)
public virtual void QueryWithRowCallbackDelegate(CommandType cmdType, string sql, RowCallbackDelegate rowCallbackDelegate, IDbParameters parameters)
{
classicAdoTemplate.QueryWithRowCallbackDelegate(cmdType, sql, rowCallbackDelegate, parameters);

Expand All @@ -803,28 +803,28 @@ public void QueryWithRowCallbackDelegate(CommandType cmdType, string sql, RowCal

#region Queries with RowMapper<T>

public IList<T> QueryWithRowMapper<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper)
public virtual IList<T> QueryWithRowMapper<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper)
{
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapper));

}


public IList<T> QueryWithRowMapper<T>(CommandType cmdType, String cmdText, IRowMapper<T> rowMapper,
public virtual IList<T> QueryWithRowMapper<T>(CommandType cmdType, String cmdText, IRowMapper<T> rowMapper,
ICommandSetter commandSetter)
{
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapper), commandSetter);

}

public IList<T> QueryWithRowMapper<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper,
public virtual IList<T> QueryWithRowMapper<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper,
string parameterName, Enum dbType, int size, object parameterValue)
{
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapper), parameterName, dbType, size, parameterValue);

}

public IList<T> QueryWithRowMapper<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper, IDbParameters parameters)
public virtual IList<T> QueryWithRowMapper<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper, IDbParameters parameters)
{
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapper), parameters);

Expand All @@ -836,27 +836,27 @@ public IList<T> QueryWithRowMapper<T>(CommandType cmdType, string cmdText, IRowM

#region Queries with RowMapperDelegate<T>

public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate)
public virtual IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate)
{
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapperDelegate));

}

public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
public virtual IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
ICommandSetter commandSetter)
{
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapperDelegate),
commandSetter);
}

public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
public virtual IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
string parameterName, Enum dbType, int size, object parameterValue)
{
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapperDelegate),
parameterName, dbType, size, parameterValue);
}

public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
public virtual IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
IDbParameters parameters)
{
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapperDelegate),
Expand All @@ -866,7 +866,7 @@ public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdTex

#region Queries with ResultSetExtractor<T>

public T QueryWithResultSetExtractor<T>(CommandType cmdType,
public virtual T QueryWithResultSetExtractor<T>(CommandType cmdType,
string cmdText,
IResultSetExtractor<T> resultSetExtractor)
{
Expand All @@ -878,23 +878,23 @@ public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdTex
return Execute<T>(new QueryCallback<T>(this, cmdType, cmdText, resultSetExtractor, null));
}

public T QueryWithResultSetExtractor<T>(CommandType commandType, string cmdText, IResultSetExtractor<T> resultSetExtractor,
public virtual T QueryWithResultSetExtractor<T>(CommandType commandType, string cmdText, IResultSetExtractor<T> resultSetExtractor,
string name, Enum dbType, int size, object parameterValue)
{
AssertUtils.ArgumentNotNull(resultSetExtractor, "resultSetExtractor", "Result Set Extractor must not be null");
return Execute<T>(new QueryCallback<T>(this, commandType, cmdText, resultSetExtractor,
CreateDbParameters(name, dbType, size, parameterValue)));
}

public T QueryWithResultSetExtractor<T>(CommandType commandType, string cmdText,
public virtual T QueryWithResultSetExtractor<T>(CommandType commandType, string cmdText,
IResultSetExtractor<T> resultSetExtractor,
IDbParameters parameters)
{
AssertUtils.ArgumentNotNull(resultSetExtractor, "resultSetExtractor", "Result Set Extractor must not be null");
return Execute<T>(new QueryCallback<T>(this, commandType, cmdText, resultSetExtractor, parameters));
}

public T QueryWithResultSetExtractor<T>(CommandType cmdType, string cmdText,
public virtual T QueryWithResultSetExtractor<T>(CommandType cmdType, string cmdText,
IResultSetExtractor<T> resultSetExtractor,
ICommandSetter commandSetter)
{
Expand All @@ -904,7 +904,7 @@ public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdTex
commandSetter));
}

public T QueryWithResultSetExtractor<T>(CommandType cmdType, string cmdText,
public virtual T QueryWithResultSetExtractor<T>(CommandType cmdType, string cmdText,
IResultSetExtractor<T> resultSetExtractor,
CommandSetterDelegate commandSetterDelegate)
{
Expand All @@ -919,7 +919,7 @@ public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdTex

#region Queries with ResultSetExtractorDelegate<T>

public T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType,
public virtual T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType,
string cmdText,
ResultSetExtractorDelegate<T> resultSetExtractorDelegate)
{
Expand All @@ -933,7 +933,7 @@ public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdTex
return Execute<T>(new QueryCallback<T>(this, cmdType, cmdText, resultSetExtractorDelegate, null));
}

public T QueryWithResultSetExtractorDelegate<T>(CommandType commandType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
public virtual T QueryWithResultSetExtractorDelegate<T>(CommandType commandType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
string paramenterName, Enum dbType, int size, object parameterValue)
{
AssertUtils.ArgumentNotNull(cmdText, "cmdText", "CommandText must not be null");
Expand All @@ -942,15 +942,15 @@ public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdTex
CreateDbParameters(paramenterName, dbType, size, parameterValue)));
}

public T QueryWithResultSetExtractorDelegate<T>(CommandType commandType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
public virtual T QueryWithResultSetExtractorDelegate<T>(CommandType commandType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
IDbParameters parameters)
{
AssertUtils.ArgumentNotNull(cmdText, "cmdText", "CommandText must not be null");
AssertUtils.ArgumentNotNull(resultSetExtractorDelegate, "resultSetExtractorDelegate", "Result set extractor delegate must not be null");
return Execute<T>(new QueryCallback<T>(this, commandType, cmdText, resultSetExtractorDelegate, parameters));
}

public T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
public virtual T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
ICommandSetter commandSetter)
{
AssertUtils.ArgumentNotNull(cmdText, "cmdText", "CommandText must not be null");
Expand All @@ -960,7 +960,7 @@ public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdTex
commandSetter));
}

public T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
public virtual T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
CommandSetterDelegate commandSetterDelegate)
{
AssertUtils.ArgumentNotNull(resultSetExtractorDelegate, "resultSetExtractorDelegate", "Result set extractor delegate must not be null");
Expand All @@ -973,26 +973,26 @@ public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdTex

#region Query for Object<T>

public T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper)
public virtual T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper)
{
IList<T> results = QueryWithRowMapper(cmdType, cmdText, rowMapper);
return DataAccessUtils.RequiredUniqueResultSet(results);
}

public T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper, ICommandSetter commandSetter)
public virtual T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper, ICommandSetter commandSetter)
{
IList<T> results = QueryWithRowMapper(cmdType, cmdText, rowMapper, commandSetter);
return DataAccessUtils.RequiredUniqueResultSet(results);
}

public T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper, IDbParameters parameters)
public virtual T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper, IDbParameters parameters)
{
IList<T> results = QueryWithRowMapper(cmdType, cmdText, rowMapper, parameters);
return DataAccessUtils.RequiredUniqueResultSet(results);
}


public T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper,
public virtual T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper,
string parameterName, Enum dbType, int size, object parameterValue)
{
IList<T> results = QueryWithRowMapper(cmdType, cmdText, rowMapper, parameterName, dbType, size, parameterValue);
Expand All @@ -1002,26 +1002,26 @@ public T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> ro

#region Query for ObjectDelegate<T>

public T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate)
public virtual T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate)
{
IList<T> results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate);
return DataAccessUtils.RequiredUniqueResultSet(results);
}

public T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate, ICommandSetter commandSetter)
public virtual T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate, ICommandSetter commandSetter)
{
IList<T> results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate, commandSetter);
return DataAccessUtils.RequiredUniqueResultSet(results);
}

public T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate, IDbParameters parameters)
public virtual T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate, IDbParameters parameters)
{
IList<T> results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate, parameters);
return DataAccessUtils.RequiredUniqueResultSet(results);
}


public T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
public virtual T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
string parameterName, Enum dbType, int size, object parameterValue)
{
IList<T> results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate, parameterName, dbType, size, parameterValue);
Expand All @@ -1032,22 +1032,22 @@ public T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMappe

#region Query with CommandCreator

public T QueryWithCommandCreator<T>(IDbCommandCreator cc, IResultSetExtractor<T> rse)
public virtual T QueryWithCommandCreator<T>(IDbCommandCreator cc, IResultSetExtractor<T> rse)
{
return QueryWithCommandCreator<T>(cc, rse, null);
}

public void QueryWithCommandCreator(IDbCommandCreator cc, IRowCallback rowCallback)
public virtual void QueryWithCommandCreator(IDbCommandCreator cc, IRowCallback rowCallback)
{
classicAdoTemplate.QueryWithCommandCreator(cc, rowCallback, null);
}

public IList<T> QueryWithCommandCreator<T>(IDbCommandCreator cc, IRowMapper<T> rowMapper)
public virtual IList<T> QueryWithCommandCreator<T>(IDbCommandCreator cc, IRowMapper<T> rowMapper)
{
return QueryWithCommandCreator<T>(cc, rowMapper, null);
}

public T QueryWithCommandCreator<T>(IDbCommandCreator cc, IResultSetExtractor<T> rse, IDictionary returnedParameters)
public virtual T QueryWithCommandCreator<T>(IDbCommandCreator cc, IResultSetExtractor<T> rse, IDictionary returnedParameters)
{
if (rse == null)
{
Expand All @@ -1058,13 +1058,13 @@ public T QueryWithCommandCreator<T>(IDbCommandCreator cc, IResultSetExtractor<T>
}


public void QueryWithCommandCreator(IDbCommandCreator cc, IRowCallback rowCallback, IDictionary returnedParameters)
public virtual void QueryWithCommandCreator(IDbCommandCreator cc, IRowCallback rowCallback, IDictionary returnedParameters)
{
classicAdoTemplate.QueryWithCommandCreator(cc, rowCallback, returnedParameters);
}


public IList<T> QueryWithCommandCreator<T>(IDbCommandCreator cc, IRowMapper<T> rowMapper, IDictionary returnedParameters)
public virtual IList<T> QueryWithCommandCreator<T>(IDbCommandCreator cc, IRowMapper<T> rowMapper, IDictionary returnedParameters)
{
if (rowMapper == null)
{
Expand All @@ -1075,13 +1075,13 @@ public IList<T> QueryWithCommandCreator<T>(IDbCommandCreator cc, IRowMapper<T> r
}


public IDictionary QueryWithCommandCreator<T>(IDbCommandCreator cc, IList namedResultSetProcessors)
public virtual IDictionary QueryWithCommandCreator<T>(IDbCommandCreator cc, IList namedResultSetProcessors)
{
return classicAdoTemplate.Execute(cc, new AdoResultProcessorsQueryCommandCallback<T>(this, namedResultSetProcessors)) as IDictionary;
}


public IDictionary QueryWithCommandCreator<T,U>(IDbCommandCreator cc, IList namedResultSetProcessors)
public virtual IDictionary QueryWithCommandCreator<T,U>(IDbCommandCreator cc, IList namedResultSetProcessors)
{
return classicAdoTemplate.Execute(cc, new AdoResultProcessorsQueryCommandCallback<T,U>(this, namedResultSetProcessors)) as IDictionary;
}
Expand Down

0 comments on commit 1f628dd

Please sign in to comment.