From 3da35dc8b394514f18984fbbcbe50df241ec942b Mon Sep 17 00:00:00 2001 From: Dmitrii Korolev Date: Sat, 14 Oct 2023 22:36:03 +0200 Subject: [PATCH 1/2] add method target for explicitconstructor --- Dapper/ExplicitConstructorAttribute.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dapper/ExplicitConstructorAttribute.cs b/Dapper/ExplicitConstructorAttribute.cs index d801af345..57d1bad82 100644 --- a/Dapper/ExplicitConstructorAttribute.cs +++ b/Dapper/ExplicitConstructorAttribute.cs @@ -5,7 +5,7 @@ namespace Dapper /// /// Tell Dapper to use an explicit constructor, passing nulls or 0s for all parameters /// - [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false)] + [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = false)] public sealed class ExplicitConstructorAttribute : Attribute { } From c1cc104d41f35c8e8efd1034892e036fcd062ad1 Mon Sep 17 00:00:00 2001 From: Dmitrii Korolev Date: Sun, 15 Oct 2023 01:44:35 +0200 Subject: [PATCH 2/2] add a noting comment (usage is limited with Dapper.AOT) --- Dapper/ExplicitConstructorAttribute.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dapper/ExplicitConstructorAttribute.cs b/Dapper/ExplicitConstructorAttribute.cs index 57d1bad82..4d5580127 100644 --- a/Dapper/ExplicitConstructorAttribute.cs +++ b/Dapper/ExplicitConstructorAttribute.cs @@ -5,6 +5,9 @@ namespace Dapper /// /// Tell Dapper to use an explicit constructor, passing nulls or 0s for all parameters /// + /// + /// Usage on methods is limited to the usage with Dapper.AOT (https://github.com/DapperLib/DapperAOT) + /// [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = false)] public sealed class ExplicitConstructorAttribute : Attribute {