我想将这个C#转换为VB.NET
internal static void CreateMap(AutoMapperService autoMapperService)
{
Player.CreateMap(autoMapperService);
RawStats.CreateMap(autoMapperService);
autoMapperService.CreateMap<string, GameTypeEnum>()
.ConvertUsing(s => GameTypeConsts.GameTypes
.First(x => x.Value == s).Key);
autoMapperService.CreateMap<string, GameModeEnum>()
.ConvertUsing(s => GameModeConsts.GameModes
.First(x => x.Value == s).Key);
autoMapperService.CreateMap<string, GameSubTypeEnum>()
.ConvertUsing(s => GameSubTypeConsts.GameSubTypes
.First(x => x.Value == s).Key);
CreateMap<Game>(autoMapperService);
CreateMap<IGame>(autoMapperService).As<Game>();
autoMapperService.CreateMap<RecentGamesDto, IEnumerable<IGame>>()
.ConvertUsing(x => x.Games.Select(autoMapperService.Map<GameDto, IGame>));
}
VB.NET:
Friend Shared Sub CreateMap(autoMapperService As AutoMapperService)
Player.CreateMap(autoMapperService)
RawStats.CreateMap(autoMapperService)
autoMapperService.CreateMap(Of String, GameTypeEnum).ConvertUsing(Function(s) GameTypeConsts.GameTypes.First(Function(x) x.Value = s).Key)
autoMapperService.CreateMap(Of String, GameModeEnum).ConvertUsing(Function(s) GameModeConsts.GameModes.First(Function(x) x.Value = s).Key)
autoMapperService.CreateMap(Of String, GameSubTypeEnum).ConvertUsing(Function(s) GameSubTypeConsts.GameSubTypes.First(Function(x) x.Value = s).Key)
CreateMap(Of Game)(autoMapperService)
CreateMap(Of IGame)(autoMapperService).[As](Of Game)()
autoMapperService.CreateMap(Of RecentGamesDto, IEnumerable(Of IGame))().ConvertUsing(Function(x) x.Games.Select(autoMapperService.Map(Of GameDto, IGame)))
End Sub
我在最后一个VB.NET Codeline上获得异常: 告诉我,我错过了物品属性
原来的项目: https://github.com/XeeX/LeagueOfLegendsAPI 这是我缺少item属性的函数: https://github.com/XeeX/LeagueOfLegendsAPI/blob/master/PortableLeagueApi.Core/Services/AutoMapperService.cs
有人能给我一个提示我缺少什么吗?
此致
答案 0 :(得分:1)
我不是100%肯定(我的VB.NET技能已经生锈),但我认为问题在于你是如何尝试将Map
方法作为参数传递给{{ 1}}方法。尝试使用AddressOf
:
Select