Skip to content

Commit 6dd2331

Browse files
Merge pull request #407 from itnnetworks/itn/patches/edagenais/npgsql-param
Npgsql+IncludeOptimized: fixes "System.NotSupportedException: CLR type System.Object isn't supported
2 parents 76f868e + 668ded1 commit 6dd2331

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/shared/Z.EF.Plus._Core.Shared/EF/DbParameter/DbParameter.CopyFrom.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ public static void CopyFrom(this DbParameter @this, DbParameter from)
5555
var property = from.GetType().GetProperty("OracleDbType");
5656
property.SetValue(@this, property.GetValue(from, null), new object[0]);
5757
}
58+
else if (fullName.Contains("Npgsql") && from.GetType().GetProperty("NpgsqlDbType") != null)
59+
{
60+
var property = from.GetType().GetProperty("NpgsqlDbType");
61+
property.SetValue(@this, property.GetValue(from, null), new object[0]);
62+
}
5863
#endif
5964

6065
@this.Value = from.Value ?? DBNull.Value;
@@ -90,6 +95,11 @@ public static void CopyFrom(this DbParameter @this, DbParameter from, string new
9095
var property = from.GetType().GetProperty("OracleDbType");
9196
property.SetValue(@this, property.GetValue(from, null), new object[0]);
9297
}
98+
else if (fullName.Contains("Npgsql") && from.GetType().GetProperty("NpgsqlDbType") != null)
99+
{
100+
var property = from.GetType().GetProperty("NpgsqlDbType");
101+
property.SetValue(@this, property.GetValue(from, null), new object[0]);
102+
}
93103
#endif
94104

95105
@this.Value = from.Value ?? DBNull.Value;

0 commit comments

Comments
 (0)