From c28184af9624f531826f651e3333ad4815278745 Mon Sep 17 00:00:00 2001 From: Tobi Date: Thu, 3 Nov 2022 11:51:01 +0100 Subject: [PATCH] fix(varbinary): add maxAttribute decision to varBinary --- src/Output-v5-0/DataContext/SqlParameterExtensions.base.cs | 4 ++-- src/Output/DataContext/SqlParameterExtensions.base.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Output-v5-0/DataContext/SqlParameterExtensions.base.cs b/src/Output-v5-0/DataContext/SqlParameterExtensions.base.cs index d0a396c..1f8bc2e 100644 --- a/src/Output-v5-0/DataContext/SqlParameterExtensions.base.cs +++ b/src/Output-v5-0/DataContext/SqlParameterExtensions.base.cs @@ -38,7 +38,7 @@ public static IEnumerable ToSqlParamCollection(this T value) var propName = property.Name; var sqlType = AppDbContext.GetSqlDbType(property.PropertyType); - if (sqlType == SqlDbType.NVarChar) + if (sqlType == SqlDbType.NVarChar || sqlType == SqlDbType.VarBinary) { var maxLengthAttribute = (MaxLengthAttribute)property.GetCustomAttributes(typeof(MaxLengthAttribute), false).FirstOrDefault(); if (maxLengthAttribute != null) @@ -115,4 +115,4 @@ public static IEnumerable ToSqlParamCollection(this T value) return result; } } -} \ No newline at end of file +} diff --git a/src/Output/DataContext/SqlParameterExtensions.base.cs b/src/Output/DataContext/SqlParameterExtensions.base.cs index d0a396c..1f8bc2e 100644 --- a/src/Output/DataContext/SqlParameterExtensions.base.cs +++ b/src/Output/DataContext/SqlParameterExtensions.base.cs @@ -38,7 +38,7 @@ public static IEnumerable ToSqlParamCollection(this T value) var propName = property.Name; var sqlType = AppDbContext.GetSqlDbType(property.PropertyType); - if (sqlType == SqlDbType.NVarChar) + if (sqlType == SqlDbType.NVarChar || sqlType == SqlDbType.VarBinary) { var maxLengthAttribute = (MaxLengthAttribute)property.GetCustomAttributes(typeof(MaxLengthAttribute), false).FirstOrDefault(); if (maxLengthAttribute != null) @@ -115,4 +115,4 @@ public static IEnumerable ToSqlParamCollection(this T value) return result; } } -} \ No newline at end of file +}