/// <summary>
        /// implementation for DbDataReader.GetDataTypeName() method
        /// </summary>
        /// <param name="ordinal"></param>
        /// <returns></returns>
        override public string GetDataTypeName(int ordinal)
        {
            AssertReaderIsOpen("GetDataTypeName");
            string result;

            if (DataRecord.HasData)
            {
                result = DataRecord.GetDataTypeName(ordinal);
            }
            else
            {
                result = TypeHelpers.GetFullName(DefaultRecordState.GetTypeUsage(ordinal));
            }
            return(result);
        }
Пример #2
0
        /// <inheritdoc />
        public override string GetDataTypeName(int ordinal)
        {
            EnsureInitialized();
            AssertReaderIsOpen("GetDataTypeName");
            string result;

            if (_dataRecord.HasData)
            {
                result = _dataRecord.GetDataTypeName(ordinal);
            }
            else
            {
                result = _defaultRecordState.GetTypeUsage(ordinal).ToString();
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        /// Helper method to get the edm TypeUsage for the specified column;
        ///
        /// If the column requested is a record, we'll pick up whatever the
        /// current record says it is, otherwise we'll take whatever was stored
        /// on our record state.
        /// </summary>
        /// <param name="ordinal"></param>
        /// <returns></returns>
        private TypeUsage GetTypeUsage(int ordinal)
        {
            // Some folks are picky about the exception we throw
            if (ordinal < 0 || ordinal >= _source.ColumnCount)
            {
                throw EntityUtil.ArgumentOutOfRange("ordinal");
            }
            TypeUsage result;

            //
            RecordState recordState = _source.CurrentColumnValues[ordinal] as RecordState;

            if (null != recordState)
            {
                result = recordState.DataRecordInfo.RecordType;
            }
            else
            {
                result = _source.GetTypeUsage(ordinal);
            }
            return(result);
        }
        /// <summary>
        ///     Helper method to get the edm TypeUsage for the specified column;
        ///     If the column requested is a record, we'll pick up whatever the
        ///     current record says it is, otherwise we'll take whatever was stored
        ///     on our record state.
        /// </summary>
        /// <param name="ordinal"> </param>
        /// <returns> </returns>
        private TypeUsage GetTypeUsage(int ordinal)
        {
            // Some folks are picky about the exception we throw
            if (ordinal < 0 ||
                ordinal >= _source.ColumnCount)
            {
                throw new ArgumentOutOfRangeException("ordinal");
            }
            TypeUsage result;

            // CONSIDER: optimize this by storing NULL in the TypeUsage list on RecordState for nested records?
            var recordState = _source.CurrentColumnValues[ordinal] as RecordState;

            if (null != recordState)
            {
                result = recordState.DataRecordInfo.RecordType;
            }
            else
            {
                result = _source.GetTypeUsage(ordinal);
            }
            return(result);
        }