From 6e69ad83e6453f347860a7e0604c6c0224c42164 Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Mon, 23 Mar 2026 20:04:54 +0500 Subject: [PATCH] fix: #881 - ProjectToType record regression --- src/Mapster/Adapters/RecordTypeAdapter.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Mapster/Adapters/RecordTypeAdapter.cs b/src/Mapster/Adapters/RecordTypeAdapter.cs index a4057111..1836fe45 100644 --- a/src/Mapster/Adapters/RecordTypeAdapter.cs +++ b/src/Mapster/Adapters/RecordTypeAdapter.cs @@ -19,17 +19,19 @@ internal class RecordTypeAdapter : ClassAdapter protected override bool CanMap(PreCompileArgument arg) { - return arg.DestinationType.IsRecordType() && arg.MapType != MapType.Projection; + return arg.DestinationType.IsRecordType(); } protected override bool CanInline(Expression source, Expression? destination, CompileArgument arg) { + if(arg.MapType == MapType.Projection) + return true; return false; } protected override Expression CreateInlineExpression(Expression source, CompileArgument arg, bool IsRequiredOnly = false) { - return base.CreateInstantiationExpression(source, arg); + return CreateInstantiationExpression(source, arg); } protected override Expression CreateInstantiationExpression(Expression source, Expression? destination, CompileArgument arg) {