I agree that their is an issue in GroupByStrategy.cs
Line 78 checks to see if uniqueKey is null
78 else if (uniqueKey == null || buildObjects == null ||
!buildObjects.Contains(uniqueKey))
then line 96 uses it as a key
96 buildObjects[uniqueKey] = outObject;
with no code in between changing it's value. If uniqueKey is null, this
will always fail. Should an error with a good description be thrown if
unique key is null?
I was having the same issue as Bob. I debugged into the code and found my
issue while setting the unique key on line 59
string uniqueKey = GetUniqueKey(resultMap, request, reader);
Inside this function it looks for a PROPERTY that matches the GroupBy
statement. In my case I was trying to use the COLUMN attribute's value
instead of the PROPERTY. So the resultMap should look like this:
<resultMap id="ReportDisplayResultMap" class="ReportDisplay"
GroupBy="Id">
<result column="ReportId" property="Id" type="Int32"
dbType="int" />
<result column="DisplayNm" property="DisplayName" type="String"
dbType="varchar" />
<result property="ReportOrderByList" resultMapping="
ReportVsp.ReportOrderByResultMap" />
</resultMap>
Maybe this needs to be in bold in the documents :)
Another thing that needs to be in the docs is the fact that the property in
the .NET code that contains the list must be defined as an IList(Of ...) vb
or IList<...> in c#. I have most of my lists defined as IEnumerable, which
error out. Switching to IList fixes the issue.
Hope this helps someone...
On 2/16/07, Bob Hanson <[EMAIL PROTECTED]> wrote:
GroupByStrategy.cs, line 96
buildObjects[uniqueKey] = outObject;
I've been trying to get a complicated groupBy map working and the code
path ends up in the else condition of the Process method. In my case,
uniqueKey is null and buildObjects ends up as an empty Hashtable. None
of the lines of code in the else condition modify the uniqueKey value
so when it gets to line 86 and attempts to insert into the hashtable,
the parameter is null which throws an exception.
Side question:
I also noticed the comment "// temp ?, we don't support constructor
tag with groupBy attribute". I assume that will change before 1.6 is
released?
Thanks,
Bob