Skip to content

Commit

Permalink
Updated AutoMapper to 9
Browse files Browse the repository at this point in the history
  • Loading branch information
babelshift committed Feb 13, 2020
1 parent e22a0c1 commit 4015148
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/SteamWebAPI2/AutoMapperConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public static void Initialize()
src => Mapper.Map<BadgesResult, BadgesResultModel>(src.Result)
);

x.CreateMap<SteamLevelResultContainer, uint?>().ConvertUsing(src =>
x.CreateMap<SteamLevelResultContainer, uint?>().ConvertUsing((src, dest) =>
{
if (src.Result == null)
{
Expand All @@ -324,15 +324,15 @@ public static void Initialize()
});

x.CreateMap<OwnedGame, OwnedGameModel>()
.ForMember(dest => dest.PlaytimeLastTwoWeeks, opts => opts.ResolveUsing(src =>
.ForMember(dest => dest.PlaytimeLastTwoWeeks, opts => opts.MapFrom((src, dest) =>
{
if (!src.Playtime2weeks.HasValue)
{
return (TimeSpan?)null;
}
return TimeSpan.FromMinutes(src.Playtime2weeks.Value);
}))
.ForMember(dest => dest.PlaytimeForever, opts => opts.ResolveUsing(src =>
.ForMember(dest => dest.PlaytimeForever, opts => opts.MapFrom((src, dest) =>
{
return TimeSpan.FromMinutes(src.PlaytimeForever);
}));
Expand Down Expand Up @@ -376,7 +376,7 @@ public static void Initialize()
#region Endpoint: SteamRemoteStorage

x.CreateMap<uint, PublishedFileVisibility>()
.ConvertUsing(src =>
.ConvertUsing((src, dest) =>
{
return (PublishedFileVisibility)src;
});
Expand All @@ -385,12 +385,12 @@ public static void Initialize()
.ForMember(dest => dest.PreviewUrl, opts => opts.MapFrom(source => new Uri(source.PreviewUrl)));
x.CreateMap<PublishedFileDetailsResultContainer, IReadOnlyCollection<PublishedFileDetailsModel>>()
.ConvertUsing(
src => Mapper.Map<IList<PublishedFileDetails>, IReadOnlyCollection<PublishedFileDetailsModel>>(
(src, dest) => Mapper.Map<IList<PublishedFileDetails>, IReadOnlyCollection<PublishedFileDetailsModel>>(
src.Result?.Result == 1 ? src.Result.Details : null)
);
x.CreateMap<PublishedFileDetailsResultContainer, PublishedFileDetailsModel>()
.ConvertUsing(
src => Mapper.Map<PublishedFileDetails, PublishedFileDetailsModel>(
(src, dest) => Mapper.Map<PublishedFileDetails, PublishedFileDetailsModel>(
src.Result?.Result == 1 ? src.Result.Details?.SingleOrDefault() : null)
);

Expand Down
2 changes: 1 addition & 1 deletion src/SteamWebAPI2/SteamWebAPI2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="automapper" Version="6.1.1" />
<PackageReference Include="automapper" Version="9.0.0" />
<PackageReference Include="newtonsoft.json" Version="10.0.3" />
<PackageReference Include="Steam.Models" Version="3.0.10" />
</ItemGroup>
Expand Down

0 comments on commit 4015148

Please sign in to comment.