diff --git a/src/FirebirdSql.Data.FirebirdClient.Tests/FbCommandTests.cs b/src/FirebirdSql.Data.FirebirdClient.Tests/FbCommandTests.cs index c5bf8f0a..639c746e 100644 --- a/src/FirebirdSql.Data.FirebirdClient.Tests/FbCommandTests.cs +++ b/src/FirebirdSql.Data.FirebirdClient.Tests/FbCommandTests.cs @@ -187,6 +187,22 @@ public async Task NamedParametersReuseTest() } } + [Test] + public async Task NamedParametersPublicAccessor() + { + await using (var command = new FbCommand("select * from test where int_field >= @x1 and int_field <= @x2", Connection)) + { + Assert.IsNotNull(command.NamedParameters, "Unexpected null reference."); + Assert.IsTrue(command.NamedParameters.Count == 0, "Expected count 0 of named parameters before command prepare."); + + await command.PrepareAsync(); + + Assert.IsTrue(command.NamedParameters.Count == 2, "Expected count 2 of named parameters after command prepare."); + Assert.AreEqual(command.NamedParameters[0], "@x1"); + Assert.AreEqual(command.NamedParameters[1], "@x2"); + } + } + [Test] public async Task ExecuteStoredProcTest() { diff --git a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbBatchCommand.cs b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbBatchCommand.cs index 1ac9faa7..9e17669d 100644 --- a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbBatchCommand.cs +++ b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbBatchCommand.cs @@ -192,6 +192,16 @@ public int BatchBufferSize } } + /// + /// Gets collection of parameters parsed from the query text during command prepare. + /// + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public IReadOnlyList NamedParameters + { + get { return _namedParameters; } + } + #endregion #region Internal Properties diff --git a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbCommand.cs b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbCommand.cs index 459cdf9e..c5a2cdea 100644 --- a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbCommand.cs +++ b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbCommand.cs @@ -198,6 +198,16 @@ public int FetchSize } } + /// + /// Gets collection of parameters parsed from the query text during command prepare. + /// + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public IReadOnlyList NamedParameters + { + get { return _namedParameters; } + } + #endregion #region Protected DbCommand Properties