From 1f628ddb6d61e478e7d91ddb65993edc351b4228 Mon Sep 17 00:00:00 2001 From: Robert Sosnowski Date: Tue, 2 Jul 2024 08:21:10 +0200 Subject: [PATCH] Make generic version of QueryWithRowMapper and QueryWithResultSetExtractor virtual (#249) --- .../Spring.Data/Data/Generic/AdoTemplate.cs | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs b/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs index a24a2ad1..db1dde82 100644 --- a/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs +++ b/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs @@ -793,7 +793,7 @@ namespace Spring.Data.Generic } - 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); @@ -803,28 +803,28 @@ namespace Spring.Data.Generic #region Queries with RowMapper - public IList QueryWithRowMapper(CommandType cmdType, string cmdText, IRowMapper rowMapper) + public virtual IList QueryWithRowMapper(CommandType cmdType, string cmdText, IRowMapper rowMapper) { return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor(rowMapper)); } - public IList QueryWithRowMapper(CommandType cmdType, String cmdText, IRowMapper rowMapper, + public virtual IList QueryWithRowMapper(CommandType cmdType, String cmdText, IRowMapper rowMapper, ICommandSetter commandSetter) { return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor(rowMapper), commandSetter); } - public IList QueryWithRowMapper(CommandType cmdType, string cmdText, IRowMapper rowMapper, + public virtual IList QueryWithRowMapper(CommandType cmdType, string cmdText, IRowMapper rowMapper, string parameterName, Enum dbType, int size, object parameterValue) { return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor(rowMapper), parameterName, dbType, size, parameterValue); } - public IList QueryWithRowMapper(CommandType cmdType, string cmdText, IRowMapper rowMapper, IDbParameters parameters) + public virtual IList QueryWithRowMapper(CommandType cmdType, string cmdText, IRowMapper rowMapper, IDbParameters parameters) { return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor(rowMapper), parameters); @@ -836,27 +836,27 @@ namespace Spring.Data.Generic #region Queries with RowMapperDelegate - public IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate) + public virtual IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate) { return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor(rowMapperDelegate)); } - public IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, + public virtual IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, ICommandSetter commandSetter) { return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor(rowMapperDelegate), commandSetter); } - public IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, + public virtual IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, string parameterName, Enum dbType, int size, object parameterValue) { return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor(rowMapperDelegate), parameterName, dbType, size, parameterValue); } - public IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, + public virtual IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, IDbParameters parameters) { return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor(rowMapperDelegate), @@ -866,7 +866,7 @@ namespace Spring.Data.Generic #region Queries with ResultSetExtractor - public T QueryWithResultSetExtractor(CommandType cmdType, + public virtual T QueryWithResultSetExtractor(CommandType cmdType, string cmdText, IResultSetExtractor resultSetExtractor) { @@ -878,7 +878,7 @@ namespace Spring.Data.Generic return Execute(new QueryCallback(this, cmdType, cmdText, resultSetExtractor, null)); } - public T QueryWithResultSetExtractor(CommandType commandType, string cmdText, IResultSetExtractor resultSetExtractor, + public virtual T QueryWithResultSetExtractor(CommandType commandType, string cmdText, IResultSetExtractor resultSetExtractor, string name, Enum dbType, int size, object parameterValue) { AssertUtils.ArgumentNotNull(resultSetExtractor, "resultSetExtractor", "Result Set Extractor must not be null"); @@ -886,7 +886,7 @@ namespace Spring.Data.Generic CreateDbParameters(name, dbType, size, parameterValue))); } - public T QueryWithResultSetExtractor(CommandType commandType, string cmdText, + public virtual T QueryWithResultSetExtractor(CommandType commandType, string cmdText, IResultSetExtractor resultSetExtractor, IDbParameters parameters) { @@ -894,7 +894,7 @@ namespace Spring.Data.Generic return Execute(new QueryCallback(this, commandType, cmdText, resultSetExtractor, parameters)); } - public T QueryWithResultSetExtractor(CommandType cmdType, string cmdText, + public virtual T QueryWithResultSetExtractor(CommandType cmdType, string cmdText, IResultSetExtractor resultSetExtractor, ICommandSetter commandSetter) { @@ -904,7 +904,7 @@ namespace Spring.Data.Generic commandSetter)); } - public T QueryWithResultSetExtractor(CommandType cmdType, string cmdText, + public virtual T QueryWithResultSetExtractor(CommandType cmdType, string cmdText, IResultSetExtractor resultSetExtractor, CommandSetterDelegate commandSetterDelegate) { @@ -919,7 +919,7 @@ namespace Spring.Data.Generic #region Queries with ResultSetExtractorDelegate - public T QueryWithResultSetExtractorDelegate(CommandType cmdType, + public virtual T QueryWithResultSetExtractorDelegate(CommandType cmdType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate) { @@ -933,7 +933,7 @@ namespace Spring.Data.Generic return Execute(new QueryCallback(this, cmdType, cmdText, resultSetExtractorDelegate, null)); } - public T QueryWithResultSetExtractorDelegate(CommandType commandType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate, + public virtual T QueryWithResultSetExtractorDelegate(CommandType commandType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate, string paramenterName, Enum dbType, int size, object parameterValue) { AssertUtils.ArgumentNotNull(cmdText, "cmdText", "CommandText must not be null"); @@ -942,7 +942,7 @@ namespace Spring.Data.Generic CreateDbParameters(paramenterName, dbType, size, parameterValue))); } - public T QueryWithResultSetExtractorDelegate(CommandType commandType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate, + public virtual T QueryWithResultSetExtractorDelegate(CommandType commandType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate, IDbParameters parameters) { AssertUtils.ArgumentNotNull(cmdText, "cmdText", "CommandText must not be null"); @@ -950,7 +950,7 @@ namespace Spring.Data.Generic return Execute(new QueryCallback(this, commandType, cmdText, resultSetExtractorDelegate, parameters)); } - public T QueryWithResultSetExtractorDelegate(CommandType cmdType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate, + public virtual T QueryWithResultSetExtractorDelegate(CommandType cmdType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate, ICommandSetter commandSetter) { AssertUtils.ArgumentNotNull(cmdText, "cmdText", "CommandText must not be null"); @@ -960,7 +960,7 @@ namespace Spring.Data.Generic commandSetter)); } - public T QueryWithResultSetExtractorDelegate(CommandType cmdType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate, + public virtual T QueryWithResultSetExtractorDelegate(CommandType cmdType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate, CommandSetterDelegate commandSetterDelegate) { AssertUtils.ArgumentNotNull(resultSetExtractorDelegate, "resultSetExtractorDelegate", "Result set extractor delegate must not be null"); @@ -973,26 +973,26 @@ namespace Spring.Data.Generic #region Query for Object - public T QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper) + public virtual T QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper) { IList results = QueryWithRowMapper(cmdType, cmdText, rowMapper); return DataAccessUtils.RequiredUniqueResultSet(results); } - public T QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper, ICommandSetter commandSetter) + public virtual T QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper, ICommandSetter commandSetter) { IList results = QueryWithRowMapper(cmdType, cmdText, rowMapper, commandSetter); return DataAccessUtils.RequiredUniqueResultSet(results); } - public T QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper, IDbParameters parameters) + public virtual T QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper, IDbParameters parameters) { IList results = QueryWithRowMapper(cmdType, cmdText, rowMapper, parameters); return DataAccessUtils.RequiredUniqueResultSet(results); } - public T QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper, + public virtual T QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper, string parameterName, Enum dbType, int size, object parameterValue) { IList results = QueryWithRowMapper(cmdType, cmdText, rowMapper, parameterName, dbType, size, parameterValue); @@ -1002,26 +1002,26 @@ namespace Spring.Data.Generic #region Query for ObjectDelegate - public T QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate) + public virtual T QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate) { IList results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate); return DataAccessUtils.RequiredUniqueResultSet(results); } - public T QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, ICommandSetter commandSetter) + public virtual T QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, ICommandSetter commandSetter) { IList results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate, commandSetter); return DataAccessUtils.RequiredUniqueResultSet(results); } - public T QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, IDbParameters parameters) + public virtual T QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, IDbParameters parameters) { IList results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate, parameters); return DataAccessUtils.RequiredUniqueResultSet(results); } - public T QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, + public virtual T QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, string parameterName, Enum dbType, int size, object parameterValue) { IList results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate, parameterName, dbType, size, parameterValue); @@ -1032,22 +1032,22 @@ namespace Spring.Data.Generic #region Query with CommandCreator - public T QueryWithCommandCreator(IDbCommandCreator cc, IResultSetExtractor rse) + public virtual T QueryWithCommandCreator(IDbCommandCreator cc, IResultSetExtractor rse) { return QueryWithCommandCreator(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 QueryWithCommandCreator(IDbCommandCreator cc, IRowMapper rowMapper) + public virtual IList QueryWithCommandCreator(IDbCommandCreator cc, IRowMapper rowMapper) { return QueryWithCommandCreator(cc, rowMapper, null); } - public T QueryWithCommandCreator(IDbCommandCreator cc, IResultSetExtractor rse, IDictionary returnedParameters) + public virtual T QueryWithCommandCreator(IDbCommandCreator cc, IResultSetExtractor rse, IDictionary returnedParameters) { if (rse == null) { @@ -1058,13 +1058,13 @@ namespace Spring.Data.Generic } - 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 QueryWithCommandCreator(IDbCommandCreator cc, IRowMapper rowMapper, IDictionary returnedParameters) + public virtual IList QueryWithCommandCreator(IDbCommandCreator cc, IRowMapper rowMapper, IDictionary returnedParameters) { if (rowMapper == null) { @@ -1075,13 +1075,13 @@ namespace Spring.Data.Generic } - public IDictionary QueryWithCommandCreator(IDbCommandCreator cc, IList namedResultSetProcessors) + public virtual IDictionary QueryWithCommandCreator(IDbCommandCreator cc, IList namedResultSetProcessors) { return classicAdoTemplate.Execute(cc, new AdoResultProcessorsQueryCommandCallback(this, namedResultSetProcessors)) as IDictionary; } - public IDictionary QueryWithCommandCreator(IDbCommandCreator cc, IList namedResultSetProcessors) + public virtual IDictionary QueryWithCommandCreator(IDbCommandCreator cc, IList namedResultSetProcessors) { return classicAdoTemplate.Execute(cc, new AdoResultProcessorsQueryCommandCallback(this, namedResultSetProcessors)) as IDictionary; }