diff --git a/build.ps1 b/build.ps1 index add4cf0..a013173 100644 --- a/build.ps1 +++ b/build.ps1 @@ -11,4 +11,4 @@ if ($connectionstring) dotnet restore .\src\Dapper.Oracle.sln dotnet build .\src\Dapper.Oracle.sln dotnet test .\src\Dapper.Oracle.sln -dotnet pack .\src\Dapper.Oracle.sln -p:PackageVersion=2.0.4 \ No newline at end of file +dotnet pack .\src\Dapper.Oracle.sln -p:PackageVersion=2.1.0 diff --git a/src/Dapper.Oracle.StrongName/Dapper.Oracle.StrongName.csproj b/src/Dapper.Oracle.StrongName/Dapper.Oracle.StrongName.csproj index 3bdda7a..ee76527 100644 --- a/src/Dapper.Oracle.StrongName/Dapper.Oracle.StrongName.csproj +++ b/src/Dapper.Oracle.StrongName/Dapper.Oracle.StrongName.csproj @@ -1,9 +1,9 @@ - + false - net7.0 + net10.0 true key.snk @@ -13,10 +13,10 @@ - + - + - \ No newline at end of file + diff --git a/src/Dapper.Oracle/Dapper.Oracle.csproj b/src/Dapper.Oracle/Dapper.Oracle.csproj index 305e81d..0289057 100644 --- a/src/Dapper.Oracle/Dapper.Oracle.csproj +++ b/src/Dapper.Oracle/Dapper.Oracle.csproj @@ -1,26 +1,28 @@ - + false - net7.0 + net10.0 -Version 2.0.4: - - Updated to use .net 7.0. - - Dependency switched to most recent version of Dapper: 2.0.123. - - Dependencies updated also for test project. - + Version 2.1.0: + - Updated to use .net 10.0. + - Dependency switched to most recent version of Dapper: 2.1.72. + - Dependencies updated also for test project. + - Fix OracleDecimal to System.Decimal conversion overflow handling + - Enriching OracleParameterInfo with flag for PII data + - + - + - \ No newline at end of file + diff --git a/src/Dapper.Oracle/OracleDynamicParameters.cs b/src/Dapper.Oracle/OracleDynamicParameters.cs index cfb6bc5..10c7029 100644 --- a/src/Dapper.Oracle/OracleDynamicParameters.cs +++ b/src/Dapper.Oracle/OracleDynamicParameters.cs @@ -1,4 +1,4 @@ -//// Based on Gist found here: https://gist.github.com/vijaysg/3096151 +//// Based on Gist found here: https://gist.github.com/vijaysg/3096151 using System; using System.Collections; @@ -109,6 +109,7 @@ public void AddDynamicParams(dynamic param) /// /// /// + /// a flag that this param contains sensitive data and it must be masked in case of logging values public void Add( string name, object value = null, @@ -121,7 +122,8 @@ public void Add( string sourceColumn = null, DataRowVersion? sourceVersion = null, OracleMappingCollectionType? collectionType = null, - int[] arrayBindSize = null) + int[] arrayBindSize = null, + bool maskValueWhenLogging = false) { Parameters[Clean(name)] = new OracleParameterInfo() { @@ -136,7 +138,8 @@ public void Add( SourceColumn = sourceColumn, SourceVersion = sourceVersion ?? DataRowVersion.Current, CollectionType = collectionType ?? OracleMappingCollectionType.None, - ArrayBindSize = arrayBindSize + ArrayBindSize = arrayBindSize, + MaskValueWhenLogging = maskValueWhenLogging }; } @@ -167,7 +170,7 @@ public T Get(string name) } return default(T); } - + return OracleValueConverter.Convert(val); } @@ -239,10 +242,10 @@ protected virtual void AddParameters(IDbCommand command, SqlMapper.Identity iden } OracleMethodHelper.SetOracleParameters(p, param); - + p.Direction = param.ParameterDirection; - - var val = param.Value; + + var val = param.Value; if (val != null && OracleTypeMapper.HasTypeHandler(val.GetType(), out var handler)) { @@ -251,7 +254,7 @@ protected virtual void AddParameters(IDbCommand command, SqlMapper.Identity iden else { p.Value = val ?? DBNull.Value; - + var s = val as string; if (s?.Length <= 4000) { @@ -262,8 +265,8 @@ protected virtual void AddParameters(IDbCommand command, SqlMapper.Identity iden { p.Size = param.Size.Value; } - } - + } + if (add) { command.Parameters.Add(p); @@ -320,6 +323,8 @@ public class OracleParameterInfo public OracleParameterMappingStatus Status { get; set; } public IDbDataParameter AttachedParam { get; set; } + + public bool MaskValueWhenLogging { get; set; } } /// @@ -328,4 +333,4 @@ public class OracleParameterInfo /// public IEnumerator GetEnumerator() => Parameters.GetEnumerator(); } -} \ No newline at end of file +} diff --git a/src/Dapper.Oracle/OracleValueConverter.cs b/src/Dapper.Oracle/OracleValueConverter.cs index fe1f579..bd7412b 100644 --- a/src/Dapper.Oracle/OracleValueConverter.cs +++ b/src/Dapper.Oracle/OracleValueConverter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data.Common; diff --git a/src/Tests.Dapper.Oracle/IntegrationTests/DatabaseFixture.cs b/src/Tests.Dapper.Oracle/IntegrationTests/DatabaseFixture.cs index 80c64c6..f3477ce 100644 --- a/src/Tests.Dapper.Oracle/IntegrationTests/DatabaseFixture.cs +++ b/src/Tests.Dapper.Oracle/IntegrationTests/DatabaseFixture.cs @@ -35,10 +35,9 @@ public void Dispose() public async Task InitializeAsync() { + // Prefer DA_OR_CONNECTION (CI / local Oracle). Do not overwrite it — a hardcoded default used to break env-based runs. var connectionString = Environment.GetEnvironmentVariable("DA_OR_CONNECTION"); - connectionString = "Data Source=localhost/dips;User Id=system;Password=oracle"; - if (string.IsNullOrEmpty(connectionString)) { var si = new ProcessStartInfo("powershell", @".\LocalOracleDockerDb.ps1"); @@ -100,4 +99,4 @@ private static string GetBootstrapFolder() } } -} \ No newline at end of file +} diff --git a/src/Tests.Dapper.Oracle/OracleValueConverterTests.cs b/src/Tests.Dapper.Oracle/OracleValueConverterTests.cs index dcc0ef5..780e41d 100644 --- a/src/Tests.Dapper.Oracle/OracleValueConverterTests.cs +++ b/src/Tests.Dapper.Oracle/OracleValueConverterTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using Dapper.Oracle; using FluentAssertions; diff --git a/src/Tests.Dapper.Oracle/Tests.Dapper.Oracle.csproj b/src/Tests.Dapper.Oracle/Tests.Dapper.Oracle.csproj index af10b18..bf51727 100644 --- a/src/Tests.Dapper.Oracle/Tests.Dapper.Oracle.csproj +++ b/src/Tests.Dapper.Oracle/Tests.Dapper.Oracle.csproj @@ -1,22 +1,27 @@ - + true - net7.0 + net10.0 false + + false + + + Category!=Integration&Category!=IntegrationTest - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -36,7 +41,7 @@ - + - \ No newline at end of file +