From 8ed62a378f89eab9ce4028e2435a483a0df932b0 Mon Sep 17 00:00:00 2001 From: Grzegorz Russek Date: Mon, 5 Aug 2024 14:36:25 +0200 Subject: [PATCH] Strings also should be allowed to respect allownull --- AmalgamationTool/DynamORM.Amalgamation.cs | 4 ++-- DynamORM/Mapper/DynamicPropertyInvoker.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AmalgamationTool/DynamORM.Amalgamation.cs b/AmalgamationTool/DynamORM.Amalgamation.cs index 0ec84cf..5b18198 100644 --- a/AmalgamationTool/DynamORM.Amalgamation.cs +++ b/AmalgamationTool/DynamORM.Amalgamation.cs @@ -13968,8 +13968,8 @@ namespace DynamORM throw new InvalidOperationException("Enumerables of enumerables are not supported"); Column = attr; - - if (attr != null && attr.AllowNull && !Type.IsNullableType()) + + if (attr != null && attr.AllowNull && !Type.IsNullableType() && Type != typeof(string)) attr.AllowNull = false; if (property.CanRead) diff --git a/DynamORM/Mapper/DynamicPropertyInvoker.cs b/DynamORM/Mapper/DynamicPropertyInvoker.cs index 684d107..29f5d09 100644 --- a/DynamORM/Mapper/DynamicPropertyInvoker.cs +++ b/DynamORM/Mapper/DynamicPropertyInvoker.cs @@ -111,7 +111,7 @@ namespace DynamORM.Mapper Column = attr; - if (attr != null && attr.AllowNull && !Type.IsNullableType()) + if (attr != null && attr.AllowNull && !Type.IsNullableType() && Type != typeof(string)) attr.AllowNull = false; if (property.CanRead)