From 6907d7ee0c863657c58f7b9ad9fd998af3abccb8 Mon Sep 17 00:00:00 2001 From: MarkPflug Date: Mon, 1 Jul 2024 14:24:47 -0700 Subject: [PATCH] Fix indexers on DataReaderAdapter. --- docs/Data/Sylvan.Data.Releases.md | 3 +++ source/Sylvan.Data/DataReaderAdapter.cs | 4 ++-- source/Sylvan.Data/Sylvan.Data.csproj | 2 +- source/Sylvan.Data/ValidatingDataReader.cs | 5 ----- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/docs/Data/Sylvan.Data.Releases.md b/docs/Data/Sylvan.Data.Releases.md index fc502c2..e1f75cd 100644 --- a/docs/Data/Sylvan.Data.Releases.md +++ b/docs/Data/Sylvan.Data.Releases.md @@ -1,5 +1,8 @@ # Sylvan.Data Release Notes +_0.2.16_ +- Fixes the base DataReaderAdapter indexer implementations to defer to GetOrdinal/GetName rather than the wrapper reader implementations. + _0.2.15_ - Adds async support to a few DbDataReader implementations that were previously missing it. This lead to incorrect behavior when used asynchronously. diff --git a/source/Sylvan.Data/DataReaderAdapter.cs b/source/Sylvan.Data/DataReaderAdapter.cs index 7dd0405..c51b15e 100644 --- a/source/Sylvan.Data/DataReaderAdapter.cs +++ b/source/Sylvan.Data/DataReaderAdapter.cs @@ -31,10 +31,10 @@ public DataReaderAdapter(DbDataReader dr) } /// - public override object this[int ordinal] => dr[ordinal]; + public override object this[int ordinal] => this.GetValue(ordinal); /// - public override object this[string name] => dr[name]; + public override object this[string name] => this.GetValue(this.GetOrdinal(name)); /// public override int Depth => dr.Depth; diff --git a/source/Sylvan.Data/Sylvan.Data.csproj b/source/Sylvan.Data/Sylvan.Data.csproj index e990b6b..179a1bf 100644 --- a/source/Sylvan.Data/Sylvan.Data.csproj +++ b/source/Sylvan.Data/Sylvan.Data.csproj @@ -2,7 +2,7 @@ net6.0;netstandard2.1;netstandard2.0 - 0.2.15 + 0.2.16 A .NET library of types for working with data objects. data;datareader;ADO.NET enable diff --git a/source/Sylvan.Data/ValidatingDataReader.cs b/source/Sylvan.Data/ValidatingDataReader.cs index 5c35b7f..d7d0abc 100644 --- a/source/Sylvan.Data/ValidatingDataReader.cs +++ b/source/Sylvan.Data/ValidatingDataReader.cs @@ -596,11 +596,6 @@ void ClearError(int ordinal) this.errorMarker[ordinal] = -1; } - - public override object this[int ordinal] => GetValue(ordinal); - - public override object this[string name] => this.GetValue(GetOrdinal(name)); - public override int Depth => 0; public override int FieldCount => inner.FieldCount;