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

Add support to Dynamic SQL via code

    XMLWordPrintableJSON

Details

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

    Description

      Add attribute sqlSource on statement tag, a type alias to a user class which implement interface ISqlSource

      Sample
      ======
      <select id="SqlSourceWithInlineParameter" parameterClass="Integer" sqlSource="SqlSourceWithInlineParameter" resultMap="account-result"/>

      public class SqlSourceWithInlineParameter : ISqlSource
      {
      #region ISqlSource Members

      /// <summary>
      /// Gets the SQL text.
      /// </summary>
      /// <param name="mappedStatement">The mapped statement.</param>
      /// <param name="parameterObject">The parameter object.</param>
      /// <returns></returns>
      public string GetSql(IMappedStatement mappedStatement, object parameterObject)
      {
      return "select * from Accounts where Account_ID = @

      {Id}

      ";
      }

      #endregion
      }

      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: