From f7f06070daab2e1559c054a3c3d8f50f4b643747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E9=AA=A5?= <1429614920@qq.com> Date: Mon, 30 Dec 2024 13:39:17 +0800 Subject: [PATCH 1/3] Update IEditorItemExtensions.cs Should support IDynamicObject in IEditorItem CanWrite method since DynamicColumnObject doesn't inherit from DynamicObject --- src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs b/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs index 29b81570756..e68459c9df0 100644 --- a/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs +++ b/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs @@ -1,6 +1,5 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the Apache 2.0 License -// See the LICENSE file in the project root for more information. +// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this +// file to you under the Apache 2.0 License See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone using System.Reflection; @@ -77,7 +76,7 @@ private static bool IsVisible(this IEditorItem item, ItemChangedType changedType /// public static bool CanWrite(this IEditorItem item, Type modelType) { - return modelType == typeof(DynamicObject) || modelType.IsSubclassOf(typeof(DynamicObject)) || ComplexCanWrite(); + return typeof(IDynamicObject).IsAssignableFrom(modelType) || ComplexCanWrite(); bool ComplexCanWrite() { From bd8f3062d94ca3db4c49ed5f75366426f4746faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E9=AA=A5?= <1429614920@qq.com> Date: Mon, 30 Dec 2024 13:43:54 +0800 Subject: [PATCH 2/3] Revert "Update IEditorItemExtensions.cs" This reverts commit f7f06070daab2e1559c054a3c3d8f50f4b643747. --- src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs b/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs index e68459c9df0..29b81570756 100644 --- a/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs +++ b/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs @@ -1,5 +1,6 @@ -// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this -// file to you under the Apache 2.0 License See the LICENSE file in the project root for more information. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the Apache 2.0 License +// See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone using System.Reflection; @@ -76,7 +77,7 @@ private static bool IsVisible(this IEditorItem item, ItemChangedType changedType /// public static bool CanWrite(this IEditorItem item, Type modelType) { - return typeof(IDynamicObject).IsAssignableFrom(modelType) || ComplexCanWrite(); + return modelType == typeof(DynamicObject) || modelType.IsSubclassOf(typeof(DynamicObject)) || ComplexCanWrite(); bool ComplexCanWrite() { From ed319b8a130709f10902080b92daa9b12d93ed36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E9=AA=A5?= <1429614920@qq.com> Date: Mon, 30 Dec 2024 13:46:09 +0800 Subject: [PATCH 3/3] Should support IDynamicObject in IEditorItem CanWrite --- src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs b/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs index 29b81570756..94f21d8ea96 100644 --- a/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs +++ b/src/BootstrapBlazor/Extensions/IEditorItemExtensions.cs @@ -77,7 +77,7 @@ private static bool IsVisible(this IEditorItem item, ItemChangedType changedType /// public static bool CanWrite(this IEditorItem item, Type modelType) { - return modelType == typeof(DynamicObject) || modelType.IsSubclassOf(typeof(DynamicObject)) || ComplexCanWrite(); + return typeof(IDynamicObject).IsAssignableFrom(modelType) || ComplexCanWrite(); bool ComplexCanWrite() {