Skip to content

Commit a65b69b

Browse files
committed
fix #258 enforce cast projection type to prevent EF error
1 parent 27babf3 commit a65b69b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Mapster/Adapters/CollectionAdapter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ protected override Expression CreateInlineExpression(Expression source, CompileA
111111
var destinationElementType = arg.DestinationType.ExtractCollectionType();
112112

113113
var p1 = Expression.Parameter(sourceElementType);
114-
var adapt = CreateAdaptExpression(p1, destinationElementType, arg);
114+
var adapt = CreateAdaptExpression(p1, destinationElementType, arg)
115+
.To(destinationElementType, true);
115116
if (adapt == p1)
116117
{
117118
if (arg.MapType == MapType.Projection)

0 commit comments

Comments
 (0)