From b15e3179f77dccbf8c1f9ceac90d482f7dda664d Mon Sep 17 00:00:00 2001 From: Jojoshua Date: Fri, 3 Nov 2023 17:12:01 -0400 Subject: [PATCH 1/2] netstandard 2.0 compile --- src/Mapster.Core/Mapster.Core.csproj | 2 +- src/Mapster/Interfaces/IMapFrom.cs | 8 ++++---- src/Mapster/Mapster.csproj | 6 +++++- src/Mapster/Utils/ReflectionUtils.cs | 5 +++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Mapster.Core/Mapster.Core.csproj b/src/Mapster.Core/Mapster.Core.csproj index df7ee33b..e4407cc9 100644 --- a/src/Mapster.Core/Mapster.Core.csproj +++ b/src/Mapster.Core/Mapster.Core.csproj @@ -1,7 +1,7 @@  Lightweight library for Mapster and Mapster CodeGen - net7.0;net6.0 + net7.0;net6.0;netstandard2.0 Mapster.Core mapster 1.2.1 diff --git a/src/Mapster/Interfaces/IMapFrom.cs b/src/Mapster/Interfaces/IMapFrom.cs index f1b004c7..43247852 100644 --- a/src/Mapster/Interfaces/IMapFrom.cs +++ b/src/Mapster/Interfaces/IMapFrom.cs @@ -2,8 +2,8 @@ namespace Mapster; public interface IMapFrom { - public void ConfigureMapping(TypeAdapterConfig config) - { - config.NewConfig(typeof(TSource), GetType()); - } + //public void ConfigureMapping(TypeAdapterConfig config) + //{ + // config.NewConfig(typeof(TSource), GetType()); + //} } \ No newline at end of file diff --git a/src/Mapster/Mapster.csproj b/src/Mapster/Mapster.csproj index 6526c895..6be0a5c0 100644 --- a/src/Mapster/Mapster.csproj +++ b/src/Mapster/Mapster.csproj @@ -4,7 +4,7 @@ A fast, fun and stimulating object to object mapper. Kind of like AutoMapper, just simpler and way, way faster. Copyright (c) 2016 Chaowlert Chaisrichalermpol, Eric Swann chaowlert;eric_swann - net7.0;net6.0 + net7.0;net6.0;netstandard2.0 Mapster A fast, fun and stimulating object to object mapper. Kind of like AutoMapper, just simpler and way, way faster. Mapster @@ -26,6 +26,10 @@ + + + + diff --git a/src/Mapster/Utils/ReflectionUtils.cs b/src/Mapster/Utils/ReflectionUtils.cs index 5959daa5..d8967720 100644 --- a/src/Mapster/Utils/ReflectionUtils.cs +++ b/src/Mapster/Utils/ReflectionUtils.cs @@ -385,4 +385,9 @@ public static bool IsInitOnly(this PropertyInfo propertyInfo) return setMethod.ReturnParameter.GetRequiredCustomModifiers().Contains(isExternalInitType); } } +} + +namespace System.Runtime.CompilerServices +{ + internal static class IsExternalInit { } } \ No newline at end of file From 58a52ab57fb671a249f7df998bfbf2f4314e1491 Mon Sep 17 00:00:00 2001 From: Jojoshua Date: Sat, 4 Nov 2023 13:25:34 -0400 Subject: [PATCH 2/2] fix failing tests (default interface implementation) --- src/Mapster/Interfaces/IMapFrom.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Mapster/Interfaces/IMapFrom.cs b/src/Mapster/Interfaces/IMapFrom.cs index 43247852..623b0595 100644 --- a/src/Mapster/Interfaces/IMapFrom.cs +++ b/src/Mapster/Interfaces/IMapFrom.cs @@ -2,8 +2,12 @@ namespace Mapster; public interface IMapFrom { - //public void ConfigureMapping(TypeAdapterConfig config) - //{ - // config.NewConfig(typeof(TSource), GetType()); - //} + +#if NET6_0_OR_GREATER + public void ConfigureMapping(TypeAdapterConfig config) + { + config.NewConfig(typeof(TSource), GetType()); + } +#endif + } \ No newline at end of file