Iterators and IsEqual

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Iterators and IsEqual

Herode
Anyone know why the following wouldn't work?

I've tried to shrink this down to the simplest solution, but in essence I have a class, with an ID and a collection of it's own type called Nested.

IE:

Public class Nested

{
..

Public int ID{ get; set; }

Public List<Nested> NestedItems{ get; set; }

}

In ibatis I then have a statement thus;

<statement id="test" parameterClass="Nested">

<iterate property="NestedItems" prepend="" conjunction="" open="" close="">

<isEqual property="NestedItems[].ID" compareValue="1">
.. do something ..
</isEqual>

 
<isNotEqual property="NestedItems[].ID" compareValue="1">
.. do something else ..
</isNotEqual>

</iterate>

</statement>


Idea being I want to iterate over the collection, and take one of two actions depending on a property value that I'm iterating over.

This throws an exception though;

IBatisNet.Common.Exceptions.ProbeException: Error getting ordinal value from .net object. CauseInput string was not in a correct format. ---> System.FormatException: Input string was not in a correct format..

I can of course write SQL to do the same job, but ideally I'd like to use the features of IBATIS to do this for me..

Please help me…

Thanks in advanced.

Regards,

Khoa Nguyen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Iterators and IsEqual

lwpro2
have you tried to put prepend and conjuction values, inside the iterator?

Herode wrote
Anyone know why the following wouldn't work?

I've tried to shrink this down to the simplest solution, but in essence I have a class, with an ID and a collection of it's own type called Nested.

IE:

Public class Nested

{
..

Public int ID{ get; set; }

Public List<Nested> NestedItems{ get; set; }

}

In ibatis I then have a statement thus;

<statement id="test" parameterClass="Nested">

<iterate property="NestedItems" prepend="" conjunction="" open="" close="">

<isEqual property="NestedItems[].ID" compareValue="1">
.. do something ..
</isEqual>

 
<isNotEqual property="NestedItems[].ID" compareValue="1">
.. do something else ..
</isNotEqual>

</iterate>

</statement>


Idea being I want to iterate over the collection, and take one of two actions depending on a property value that I'm iterating over.

This throws an exception though;

IBatisNet.Common.Exceptions.ProbeException: Error getting ordinal value from .net object. CauseInput string was not in a correct format. ---> System.FormatException: Input string was not in a correct format..

I can of course write SQL to do the same job, but ideally I'd like to use the features of IBATIS to do this for me..

Please help me…

Thanks in advanced.

Regards,

Khoa Nguyen
Loading...