Beispiel #1
0
        /// <summary>
        /// Returns the first record from the query result.
        /// </summary>
        /// <returns>depending on T, single value or all fields values from the first record</returns>
        public T Single <T>()
        {
            var res = new SingleDataReaderResult <T>(Read <T>);

            ExecuteReader(res, 1);
            return(res.Result);
        }
Beispiel #2
0
        /// <summary>
        /// Returns dictionary with first record values.
        /// </summary>
        /// <returns>dictionary with field values or null if query returns zero records.</returns>
        public Dictionary <string, object> ToDictionary()
        {
            var res = new SingleDataReaderResult <Dictionary <string, object> >(ReadDictionary);

            ExecuteReader(res, 1);
            return(res.Result);
        }
            /// <summary>
            /// Returns dictionary with first record values.
            /// </summary>
            /// <returns>dictionary with field values or null if query returns zero records.</returns>
            public Dictionary <string, object> ToDictionary()
            {
                var res = new SingleDataReaderResult <Dictionary <string, object> >(ReadDictionary);

                using (var selectCmd = GetSelectCmd()) {
                    DataHelper.ExecuteReader(selectCmd, CommandBehavior.SingleRow, DataReaderRecordOffset, 1, res);
                }
                return(res.Result);
            }
            /// <summary>
            /// Returns the first record from the query result.
            /// </summary>
            /// <returns>depending on T, single value or all fields values from the first record</returns>
            public T Single <T>()
            {
                var res = new SingleDataReaderResult <T>(Read <T>);

                using (var selectCmd = GetSelectCmd()) {
                    DataHelper.ExecuteReader(selectCmd, CommandBehavior.SingleRow, DataReaderRecordOffset, 1, res);
                }
                return(res.Result);
            }