Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using AutoMapper;
using Microsoft.Extensions.Logging.Abstractions;

namespace AutomapperVsMapster.AttributeMapping.AutoMapper;
public class AutoMapperAttributeMapping
{
public static IMapper Mapper = new MapperConfiguration(cfg => cfg.AddMaps(typeof(AutoMapperAttributeMapping).Assembly)).CreateMapper();
public static IMapper Mapper = new MapperConfiguration(cfg => cfg.AddMaps(typeof(AutoMapperAttributeMapping).Assembly), NullLoggerFactory.Instance).CreateMapper();

public static UserDto Map(User source)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="11.0.1" />
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="Mapster" Version="7.3.0" />
<PackageReference Include="AutoMapper" Version="16.2.0" />
<PackageReference Include="Bogus" Version="35.6.5" />
<PackageReference Include="Mapster" Version="10.0.11" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using AutoMapper;
using Microsoft.Extensions.Logging.Abstractions;

namespace AutomapperVsMapster.CollectionMapping;
public class AutoMapperCollectionMapping
{
public static IMapper Mapper = new MapperConfiguration(cfg => cfg.CreateMap<User, UserDto>()).CreateMapper();
public static IMapper Mapper = new MapperConfiguration(cfg => cfg.CreateMap<User, UserDto>(), NullLoggerFactory.Instance).CreateMapper();

public static List<UserDto> Map(List<User> source)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AutoMapper;
using Microsoft.Extensions.Logging.Abstractions;

namespace AutomapperVsMapster.CustomPropertyMapping;
public class AutoMapperCustomPropertyMapping
Expand All @@ -10,7 +11,7 @@ public class AutoMapperCustomPropertyMapping
dest => dest.FullName,
config => config.MapFrom(src => $"{src.FirstName} {src.LastName}"
));
})
}, NullLoggerFactory.Instance)
.CreateMapper();

public static UserDto Map(User source)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using AutoMapper;
using Microsoft.Extensions.Logging.Abstractions;

namespace AutomapperVsMapster.Flattened;
public class AutoMapperFlattenedMapping
{
public static IMapper Mapper = new MapperConfiguration(cfg =>
{
cfg.CreateMap<User, UserDto>();
})
}, NullLoggerFactory.Instance)
.CreateMapper();

public static UserDto Map(User source)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AutoMapper;
using Microsoft.Extensions.Logging.Abstractions;

namespace AutomapperVsMapster.NestedTypeMapping;
public class AutoMapperNestedTypeMapping
Expand All @@ -7,7 +8,7 @@ public class AutoMapperNestedTypeMapping
{
cfg.CreateMap<User, UserDto>();
cfg.CreateMap<Address, AddressDto>();
})
}, NullLoggerFactory.Instance)
.CreateMapper();

public static UserDto Map(User source)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AutoMapper;
using Microsoft.Extensions.Logging.Abstractions;

namespace AutomapperVsMapster.ReverseMappingAndUnflattening;
public class AutoMapperReverseMapping
Expand All @@ -8,7 +9,7 @@ public class AutoMapperReverseMapping
cfg.CreateMap<User, UserDto>()
.ForMember(dest => dest.EmailAddress, config => config.MapFrom(src => src.Email))
.ReverseMap();
})
}, NullLoggerFactory.Instance)
.CreateMapper();

public static User Map(UserDto destination)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using AutoMapper;
using Microsoft.Extensions.Logging.Abstractions;

namespace AutomapperVsMapster.SimpleTypeMapping;
public class AutoMapperSimpleTypeMapping
{
public static IMapper Mapper = new MapperConfiguration(cfg => cfg.CreateMap<User, UserDto>()).CreateMapper();
public static IMapper Mapper = new MapperConfiguration(cfg => cfg.CreateMap<User, UserDto>(), NullLoggerFactory.Instance).CreateMapper();

public static UserDto Map(User source)
{
Expand Down
10 changes: 5 additions & 5 deletions dotnet-client-libraries/AutomapperVsMapster/Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.9.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Loading