示例#1
0
        // <summary>
        // Given a store datareader, a column name, find the column ordinal
        // in the datareader with the name of the column.
        // We only have the functionImport provided to include it in the exception
        // message.
        // </summary>
        private static int GetDiscriminatorOrdinalFromReader(DbDataReader storeDataReader, string columnName, EdmFunction functionImport)
        {
            int result;

            if (!TryGetColumnOrdinalFromReader(storeDataReader, columnName, out result))
            {
                throw new EntityCommandExecutionException(
                          Strings.ADP_InvalidDataReaderMissingDiscriminatorColumn(columnName, functionImport.FullName));
            }
            return(result);
        }
        private static int GetDiscriminatorOrdinalFromReader(
            DbDataReader storeDataReader,
            string columnName,
            EdmFunction functionImport)
        {
            int ordinal;

            if (!ColumnMapFactory.TryGetColumnOrdinalFromReader(storeDataReader, columnName, out ordinal))
            {
                throw new EntityCommandExecutionException(Strings.ADP_InvalidDataReaderMissingDiscriminatorColumn((object)columnName, (object)functionImport.FullName));
            }
            return(ordinal);
        }