Пример #1
0
        public BenchmarkContainer()
        {
            var json = File.ReadAllText("spotifyAlbum.json");

            _spotifyAlbumDto = SpotifyAlbumDto.FromJson(json);



            //Console.WriteLine(JsonConvert.SerializeObject(_spotifyAlbumDto));

            //Automapper Configuration
            var mapperConfig = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <SpotifyAlbumDto, SpotifyAlbum>();
                cfg.CreateMap <CopyrightDto, Copyright>();
                cfg.CreateMap <ArtistDto, Artist>();
                cfg.CreateMap <ExternalIdsDto, ExternalIds>();
                cfg.CreateMap <ExternalUrlsDto, ExternalUrls>();
                cfg.CreateMap <TracksDto, Tracks>();
                cfg.CreateMap <ImageDto, Image>();
                cfg.CreateMap <ItemDto, Item>();
                cfg.CreateMap <SpotifyAlbum, SpotifyAlbumDto>();
                cfg.CreateMap <Copyright, CopyrightDto>();
                cfg.CreateMap <Artist, ArtistDto>();
                cfg.CreateMap <ExternalIds, ExternalIdsDto>();
                cfg.CreateMap <ExternalUrls, ExternalUrlsDto>();
                cfg.CreateMap <Tracks, TracksDto>();
                cfg.CreateMap <Image, ImageDto>();
                cfg.CreateMap <Item, ItemDto>();
            });

            _autoMapper = mapperConfig.CreateMapper();
            //TinyMapper Configuration
            TinyMapper.Bind <SpotifyAlbumDto, SpotifyAlbum>();
            TinyMapper.Bind <CopyrightDto, Copyright>();
            TinyMapper.Bind <ArtistDto, Artist>();
            TinyMapper.Bind <ExternalIdsDto, ExternalIds>();
            TinyMapper.Bind <ExternalUrlsDto, ExternalUrls>();
            TinyMapper.Bind <TracksDto, Tracks>();
            TinyMapper.Bind <ImageDto, Image>();
            TinyMapper.Bind <ItemDto, Item>();
            TinyMapper.Bind <SpotifyAlbum, SpotifyAlbumDto>();
            TinyMapper.Bind <Copyright, CopyrightDto>();
            TinyMapper.Bind <Artist, ArtistDto>();
            TinyMapper.Bind <ExternalIds, ExternalIdsDto>();
            TinyMapper.Bind <ExternalUrls, ExternalUrlsDto>();
            TinyMapper.Bind <Tracks, TracksDto>();
            TinyMapper.Bind <Image, ImageDto>();
            TinyMapper.Bind <Item, ItemDto>();
        }
Пример #2
0
        public BenchmarkContainer()
        {
            var json = File.ReadAllText("spotifyAlbum.json");

            _spotifyAlbumDto = SpotifyAlbumDto.FromJson(json);

            //Automapper Configuration
            var mapperConfig = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <SpotifyAlbumDto, SpotifyAlbum>();
                cfg.CreateMap <CopyrightDto, Copyright>();
                cfg.CreateMap <ArtistDto, Artist>();
                cfg.CreateMap <ExternalIdsDto, ExternalIds>();
                cfg.CreateMap <ExternalUrlsDto, ExternalUrls>();
                cfg.CreateMap <TracksDto, Tracks>();
                cfg.CreateMap <ImageDto, Image>();
                cfg.CreateMap <ItemDto, Item>();
                cfg.CreateMap <SpotifyAlbum, SpotifyAlbumDto>();
                cfg.CreateMap <Copyright, CopyrightDto>();
                cfg.CreateMap <Artist, ArtistDto>();
                cfg.CreateMap <ExternalIds, ExternalIdsDto>();
                cfg.CreateMap <ExternalUrls, ExternalUrlsDto>();
                cfg.CreateMap <Tracks, TracksDto>();
                cfg.CreateMap <Image, ImageDto>();
                cfg.CreateMap <Item, ItemDto>();
            });

            _autoMapper = mapperConfig.CreateMapper();

            //TinyMapper Configuration
            Nelibur.ObjectMapper.TinyMapper.Bind <SpotifyAlbumDto, SpotifyAlbum>();
            Nelibur.ObjectMapper.TinyMapper.Bind <CopyrightDto, Copyright>();
            Nelibur.ObjectMapper.TinyMapper.Bind <ArtistDto, Artist>();
            Nelibur.ObjectMapper.TinyMapper.Bind <ExternalIdsDto, ExternalIds>();
            Nelibur.ObjectMapper.TinyMapper.Bind <ExternalUrlsDto, ExternalUrls>();
            Nelibur.ObjectMapper.TinyMapper.Bind <TracksDto, Tracks>();
            Nelibur.ObjectMapper.TinyMapper.Bind <ImageDto, Image>();
            Nelibur.ObjectMapper.TinyMapper.Bind <ItemDto, Item>();
            Nelibur.ObjectMapper.TinyMapper.Bind <SpotifyAlbum, SpotifyAlbumDto>();
            Nelibur.ObjectMapper.TinyMapper.Bind <Copyright, CopyrightDto>();
            Nelibur.ObjectMapper.TinyMapper.Bind <Artist, ArtistDto>();
            Nelibur.ObjectMapper.TinyMapper.Bind <ExternalIds, ExternalIdsDto>();
            Nelibur.ObjectMapper.TinyMapper.Bind <ExternalUrls, ExternalUrlsDto>();
            Nelibur.ObjectMapper.TinyMapper.Bind <Tracks, TracksDto>();
            Nelibur.ObjectMapper.TinyMapper.Bind <Image, ImageDto>();
            Nelibur.ObjectMapper.TinyMapper.Bind <Item, ItemDto>();

            //ExpressMapper Configuration
            global::ExpressMapper.Mapper.Register <SpotifyAlbumDto, SpotifyAlbum>();
            global::ExpressMapper.Mapper.Register <CopyrightDto, Copyright>();
            global::ExpressMapper.Mapper.Register <ArtistDto, Artist>();
            global::ExpressMapper.Mapper.Register <ExternalIdsDto, ExternalIds>();
            global::ExpressMapper.Mapper.Register <ExternalUrlsDto, ExternalUrls>();
            global::ExpressMapper.Mapper.Register <TracksDto, Tracks>();
            global::ExpressMapper.Mapper.Register <ImageDto, Image>();
            global::ExpressMapper.Mapper.Register <ItemDto, Item>();
            global::ExpressMapper.Mapper.Register <SpotifyAlbum, SpotifyAlbumDto>();
            global::ExpressMapper.Mapper.Register <Copyright, CopyrightDto>();
            global::ExpressMapper.Mapper.Register <Artist, ArtistDto>();
            global::ExpressMapper.Mapper.Register <ExternalIds, ExternalIdsDto>();
            global::ExpressMapper.Mapper.Register <ExternalUrls, ExternalUrlsDto>();
            global::ExpressMapper.Mapper.Register <Tracks, TracksDto>();
            global::ExpressMapper.Mapper.Register <Image, ImageDto>();
            global::ExpressMapper.Mapper.Register <Item, ItemDto>();

            //Mapster don't need configuration
            //AgileMapper don't need configuration
        }