Skip to content

Commit d0c9c70

Browse files
committed
Add ProjectToAttribute
1 parent cd0095a commit d0c9c70

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/Mapster.Async.Tests/AsyncTest.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using System;
2-
using System.Linq.Expressions;
3-
using System.Threading;
42
using System.Threading.Tasks;
5-
using ExpressionDebugger;
63
using Microsoft.VisualStudio.TestTools.UnitTesting;
74
using Shouldly;
85

src/Mapster.Core/Attributes/BaseAdaptAttribute.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,17 @@ public class AdaptTwoWaysAttribute : AdaptToAttribute
4646
public AdaptTwoWaysAttribute(Type type) : base(type) { }
4747
public AdaptTwoWaysAttribute(string name) : base(name) { }
4848
}
49+
50+
public class ProjectToAttribute : AdaptToAttribute
51+
{
52+
public ProjectToAttribute(Type type) : base(type)
53+
{
54+
MapType = MapType.Projection;
55+
}
56+
57+
public ProjectToAttribute(string name) : base(name)
58+
{
59+
MapType = MapType.Projection;
60+
}
61+
}
4962
}

src/Mapster.Tool/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ private static void GenerateExtensions(ExtensionOptions opt)
389389
{
390390
var tuple = new TypeTuple(type, toType);
391391
var mapType = attr.MapType == 0
392-
? MapType.Map | MapType.MapToTarget | MapType.Projection
392+
? MapType.Map | MapType.MapToTarget
393393
: attr.MapType;
394394
GenerateExtensionMethods(mapType, cloned, tuple, translator, type, mapperAttr.IsHelperClass);
395395
}

0 commit comments

Comments
 (0)