Uploaded image for project: 'iBatis for .NET'
  1. iBatis for .NET
  2. IBATISNET-269

Show NVelocity Dynamic SQL syntax support

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • DataMapper 3.0
    • DataMapper 3.0
    • DataMapper
    • None

    Description

      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);

      Attachments

        Activity

          People

            gilles Gilles Bayon
            gilles Gilles Bayon
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: