Beispiel #1
0
 /// <summary>
 /// Executes a SQL SELECT statement that returns  data
 /// to populate a DataTable.
 /// If a resultMap is specified, the column name will be the result property name.
 /// </summary>
 /// <param name="statementId">The statement id.</param>
 /// <param name="parameterObject">The parameter object.</param>
 /// <returns>A DataTable</returns>
 public DataTable QueryForDataTable(string statementId, object parameterObject)
 {
     using (var sessionScope = new DataMapperLocalSessionScope(sessionStore, sessionFactory))
     {
         IMappedStatement statement = GetMappedStatement(statementId);
         return(statement.ExecuteQueryForDataTable(sessionScope.Session, parameterObject));
     }
 }
        /// <summary>
        /// Gets the value of an argument constructor.
        /// </summary>
        /// <param name="request">The current <see cref="RequestScope"/>.</param>
        /// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
        /// <param name="reader">The current <see cref="IDataReader"/>.</param>
        /// <param name="keys">The keys</param>
        /// <returns>The paremeter value.</returns>
        public object GetValue(RequestScope request, ResultProperty mapping,
                               ref IDataReader reader, object keys)
        {
            // Get the select statement
            IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);

            reader = DataReaderTransformer.Transform(reader, request.Session.DataSource.DbProvider);
            return(selectStatement.ExecuteQueryForDataTable(request.Session, keys));
        }