Skip to content

Commit 1f628dd

Browse files
authored
Make generic version of QueryWithRowMapper and QueryWithResultSetExtractor virtual (#249)
1 parent 4b86a88 commit 1f628dd

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

Diff for: src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs

+35-35
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ public virtual void QueryWithRowCallbackDelegate(CommandType cmdType, string sql
793793

794794
}
795795

796-
public void QueryWithRowCallbackDelegate(CommandType cmdType, string sql, RowCallbackDelegate rowCallbackDelegate, IDbParameters parameters)
796+
public virtual void QueryWithRowCallbackDelegate(CommandType cmdType, string sql, RowCallbackDelegate rowCallbackDelegate, IDbParameters parameters)
797797
{
798798
classicAdoTemplate.QueryWithRowCallbackDelegate(cmdType, sql, rowCallbackDelegate, parameters);
799799

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

804804
#region Queries with RowMapper<T>
805805

806-
public IList<T> QueryWithRowMapper<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper)
806+
public virtual IList<T> QueryWithRowMapper<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper)
807807
{
808808
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapper));
809809

810810
}
811811

812812

813-
public IList<T> QueryWithRowMapper<T>(CommandType cmdType, String cmdText, IRowMapper<T> rowMapper,
813+
public virtual IList<T> QueryWithRowMapper<T>(CommandType cmdType, String cmdText, IRowMapper<T> rowMapper,
814814
ICommandSetter commandSetter)
815815
{
816816
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapper), commandSetter);
817817

818818
}
819819

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

825825
}
826826

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

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

837837
#region Queries with RowMapperDelegate<T>
838838

839-
public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate)
839+
public virtual IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate)
840840
{
841841
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapperDelegate));
842842

843843
}
844844

845-
public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
845+
public virtual IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
846846
ICommandSetter commandSetter)
847847
{
848848
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapperDelegate),
849849
commandSetter);
850850
}
851851

852-
public IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
852+
public virtual IList<T> QueryWithRowMapperDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate,
853853
string parameterName, Enum dbType, int size, object parameterValue)
854854
{
855855
return QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor<T>(rowMapperDelegate),
856856
parameterName, dbType, size, parameterValue);
857857
}
858858

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

867867
#region Queries with ResultSetExtractor<T>
868868

869-
public T QueryWithResultSetExtractor<T>(CommandType cmdType,
869+
public virtual T QueryWithResultSetExtractor<T>(CommandType cmdType,
870870
string cmdText,
871871
IResultSetExtractor<T> resultSetExtractor)
872872
{
@@ -878,23 +878,23 @@ public T QueryWithResultSetExtractor<T>(CommandType cmdType,
878878
return Execute<T>(new QueryCallback<T>(this, cmdType, cmdText, resultSetExtractor, null));
879879
}
880880

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

889-
public T QueryWithResultSetExtractor<T>(CommandType commandType, string cmdText,
889+
public virtual T QueryWithResultSetExtractor<T>(CommandType commandType, string cmdText,
890890
IResultSetExtractor<T> resultSetExtractor,
891891
IDbParameters parameters)
892892
{
893893
AssertUtils.ArgumentNotNull(resultSetExtractor, "resultSetExtractor", "Result Set Extractor must not be null");
894894
return Execute<T>(new QueryCallback<T>(this, commandType, cmdText, resultSetExtractor, parameters));
895895
}
896896

897-
public T QueryWithResultSetExtractor<T>(CommandType cmdType, string cmdText,
897+
public virtual T QueryWithResultSetExtractor<T>(CommandType cmdType, string cmdText,
898898
IResultSetExtractor<T> resultSetExtractor,
899899
ICommandSetter commandSetter)
900900
{
@@ -904,7 +904,7 @@ public T QueryWithResultSetExtractor<T>(CommandType cmdType, string cmdText,
904904
commandSetter));
905905
}
906906

907-
public T QueryWithResultSetExtractor<T>(CommandType cmdType, string cmdText,
907+
public virtual T QueryWithResultSetExtractor<T>(CommandType cmdType, string cmdText,
908908
IResultSetExtractor<T> resultSetExtractor,
909909
CommandSetterDelegate commandSetterDelegate)
910910
{
@@ -919,7 +919,7 @@ public T QueryWithResultSetExtractor<T>(CommandType cmdType, string cmdText,
919919

920920
#region Queries with ResultSetExtractorDelegate<T>
921921

922-
public T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType,
922+
public virtual T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType,
923923
string cmdText,
924924
ResultSetExtractorDelegate<T> resultSetExtractorDelegate)
925925
{
@@ -933,7 +933,7 @@ public T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType,
933933
return Execute<T>(new QueryCallback<T>(this, cmdType, cmdText, resultSetExtractorDelegate, null));
934934
}
935935

936-
public T QueryWithResultSetExtractorDelegate<T>(CommandType commandType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
936+
public virtual T QueryWithResultSetExtractorDelegate<T>(CommandType commandType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
937937
string paramenterName, Enum dbType, int size, object parameterValue)
938938
{
939939
AssertUtils.ArgumentNotNull(cmdText, "cmdText", "CommandText must not be null");
@@ -942,15 +942,15 @@ public T QueryWithResultSetExtractorDelegate<T>(CommandType commandType, string
942942
CreateDbParameters(paramenterName, dbType, size, parameterValue)));
943943
}
944944

945-
public T QueryWithResultSetExtractorDelegate<T>(CommandType commandType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
945+
public virtual T QueryWithResultSetExtractorDelegate<T>(CommandType commandType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
946946
IDbParameters parameters)
947947
{
948948
AssertUtils.ArgumentNotNull(cmdText, "cmdText", "CommandText must not be null");
949949
AssertUtils.ArgumentNotNull(resultSetExtractorDelegate, "resultSetExtractorDelegate", "Result set extractor delegate must not be null");
950950
return Execute<T>(new QueryCallback<T>(this, commandType, cmdText, resultSetExtractorDelegate, parameters));
951951
}
952952

953-
public T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
953+
public virtual T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
954954
ICommandSetter commandSetter)
955955
{
956956
AssertUtils.ArgumentNotNull(cmdText, "cmdText", "CommandText must not be null");
@@ -960,7 +960,7 @@ public T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType, string cmdT
960960
commandSetter));
961961
}
962962

963-
public T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
963+
public virtual T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType, string cmdText, ResultSetExtractorDelegate<T> resultSetExtractorDelegate,
964964
CommandSetterDelegate commandSetterDelegate)
965965
{
966966
AssertUtils.ArgumentNotNull(resultSetExtractorDelegate, "resultSetExtractorDelegate", "Result set extractor delegate must not be null");
@@ -973,26 +973,26 @@ public T QueryWithResultSetExtractorDelegate<T>(CommandType cmdType, string cmdT
973973

974974
#region Query for Object<T>
975975

976-
public T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper)
976+
public virtual T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper)
977977
{
978978
IList<T> results = QueryWithRowMapper(cmdType, cmdText, rowMapper);
979979
return DataAccessUtils.RequiredUniqueResultSet(results);
980980
}
981981

982-
public T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper, ICommandSetter commandSetter)
982+
public virtual T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper, ICommandSetter commandSetter)
983983
{
984984
IList<T> results = QueryWithRowMapper(cmdType, cmdText, rowMapper, commandSetter);
985985
return DataAccessUtils.RequiredUniqueResultSet(results);
986986
}
987987

988-
public T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper, IDbParameters parameters)
988+
public virtual T QueryForObject<T>(CommandType cmdType, string cmdText, IRowMapper<T> rowMapper, IDbParameters parameters)
989989
{
990990
IList<T> results = QueryWithRowMapper(cmdType, cmdText, rowMapper, parameters);
991991
return DataAccessUtils.RequiredUniqueResultSet(results);
992992
}
993993

994994

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

10031003
#region Query for ObjectDelegate<T>
10041004

1005-
public T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate)
1005+
public virtual T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate)
10061006
{
10071007
IList<T> results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate);
10081008
return DataAccessUtils.RequiredUniqueResultSet(results);
10091009
}
10101010

1011-
public T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate, ICommandSetter commandSetter)
1011+
public virtual T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate, ICommandSetter commandSetter)
10121012
{
10131013
IList<T> results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate, commandSetter);
10141014
return DataAccessUtils.RequiredUniqueResultSet(results);
10151015
}
10161016

1017-
public T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate, IDbParameters parameters)
1017+
public virtual T QueryForObjectDelegate<T>(CommandType cmdType, string cmdText, RowMapperDelegate<T> rowMapperDelegate, IDbParameters parameters)
10181018
{
10191019
IList<T> results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate, parameters);
10201020
return DataAccessUtils.RequiredUniqueResultSet(results);
10211021
}
10221022

10231023

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

10331033
#region Query with CommandCreator
10341034

1035-
public T QueryWithCommandCreator<T>(IDbCommandCreator cc, IResultSetExtractor<T> rse)
1035+
public virtual T QueryWithCommandCreator<T>(IDbCommandCreator cc, IResultSetExtractor<T> rse)
10361036
{
10371037
return QueryWithCommandCreator<T>(cc, rse, null);
10381038
}
10391039

1040-
public void QueryWithCommandCreator(IDbCommandCreator cc, IRowCallback rowCallback)
1040+
public virtual void QueryWithCommandCreator(IDbCommandCreator cc, IRowCallback rowCallback)
10411041
{
10421042
classicAdoTemplate.QueryWithCommandCreator(cc, rowCallback, null);
10431043
}
10441044

1045-
public IList<T> QueryWithCommandCreator<T>(IDbCommandCreator cc, IRowMapper<T> rowMapper)
1045+
public virtual IList<T> QueryWithCommandCreator<T>(IDbCommandCreator cc, IRowMapper<T> rowMapper)
10461046
{
10471047
return QueryWithCommandCreator<T>(cc, rowMapper, null);
10481048
}
10491049

1050-
public T QueryWithCommandCreator<T>(IDbCommandCreator cc, IResultSetExtractor<T> rse, IDictionary returnedParameters)
1050+
public virtual T QueryWithCommandCreator<T>(IDbCommandCreator cc, IResultSetExtractor<T> rse, IDictionary returnedParameters)
10511051
{
10521052
if (rse == null)
10531053
{
@@ -1058,13 +1058,13 @@ public T QueryWithCommandCreator<T>(IDbCommandCreator cc, IResultSetExtractor<T>
10581058
}
10591059

10601060

1061-
public void QueryWithCommandCreator(IDbCommandCreator cc, IRowCallback rowCallback, IDictionary returnedParameters)
1061+
public virtual void QueryWithCommandCreator(IDbCommandCreator cc, IRowCallback rowCallback, IDictionary returnedParameters)
10621062
{
10631063
classicAdoTemplate.QueryWithCommandCreator(cc, rowCallback, returnedParameters);
10641064
}
10651065

10661066

1067-
public IList<T> QueryWithCommandCreator<T>(IDbCommandCreator cc, IRowMapper<T> rowMapper, IDictionary returnedParameters)
1067+
public virtual IList<T> QueryWithCommandCreator<T>(IDbCommandCreator cc, IRowMapper<T> rowMapper, IDictionary returnedParameters)
10681068
{
10691069
if (rowMapper == null)
10701070
{
@@ -1075,13 +1075,13 @@ public IList<T> QueryWithCommandCreator<T>(IDbCommandCreator cc, IRowMapper<T> r
10751075
}
10761076

10771077

1078-
public IDictionary QueryWithCommandCreator<T>(IDbCommandCreator cc, IList namedResultSetProcessors)
1078+
public virtual IDictionary QueryWithCommandCreator<T>(IDbCommandCreator cc, IList namedResultSetProcessors)
10791079
{
10801080
return classicAdoTemplate.Execute(cc, new AdoResultProcessorsQueryCommandCallback<T>(this, namedResultSetProcessors)) as IDictionary;
10811081
}
10821082

10831083

1084-
public IDictionary QueryWithCommandCreator<T,U>(IDbCommandCreator cc, IList namedResultSetProcessors)
1084+
public virtual IDictionary QueryWithCommandCreator<T,U>(IDbCommandCreator cc, IList namedResultSetProcessors)
10851085
{
10861086
return classicAdoTemplate.Execute(cc, new AdoResultProcessorsQueryCommandCallback<T,U>(this, namedResultSetProcessors)) as IDictionary;
10871087
}

0 commit comments

Comments
 (0)