Show NVelocity Dynamic SQL syntax support
-----------------------------------------
Key: IBATISNET-269
URL: https://issues.apache.org/jira/browse/IBATISNET-269
Project: iBatis for .NET
Issue Type: New Feature
Components: DataMapper
Affects Versions: DataMapper 3.0
Reporter: Gilles Bayon
Assignee: Gilles Bayon
Fix For: DataMapper 3.0
Paremeters should be typeof IDictionary<string, object>
Samples
=======
<!-- Nvelocity dynamic source -->
<select id="NVelocity.Simple" sqlSource="NVelocitySqlSource"
resultMap="account-result" parameterClass="map">
select * from Accounts where Account_Id= $account.id
</select>
<select id="NVelocity.If" sqlSource="NVelocitySqlSource"
resultClass="Account" remapResults="true" parameterClass="map">
SELECT
Account_ID as Id,
#if($account.FirstName == "Joe")
Account_FirstName as FirstName,
#elseif($account.LastName == "Dalton")
Account_LastName as LastName,
#end
Account_Email as EmailAddress
FROM
Accounts
where Account_Id= $account.id
</select>
Use as usual
IDictionary<string, object> parameters = new Dictionary<string,
object>();
parameters.Add("account", paramAccount);
Account account =
dataMapper.QueryForObject<Account>("NVelocity.Simple", parameters);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.