public AutoMapperConfigurationStartupTask(IConfigurationProvider configurationProvider, IProfileExpression profileExpression, IMapCreator[] mapCreators)
        {
            if (configurationProvider == null)
            {
                throw new ArgumentNullException("configurationProvider");
            }

            if (profileExpression == null)
            {
                throw new ArgumentNullException("profileExpression");
            }

            if (mapCreators == null)
            {
                throw new ArgumentNullException("mapCreators");
            }

            if (mapCreators.Length == 0)
            {
                throw new ArgumentException("Cannot be an empty array", "mapCreators");
            }

            _configurationProvider = configurationProvider;
            _profileExpression = profileExpression;
            _mapCreators = mapCreators;
        }
Exemplo n.º 2
0
 static void SetupGamespy(IProfileExpression mapConfig) {
     mapConfig.CreateMap<GamespyServerQueryResult, Server>()
         .ForMember(x => x.IsDedicated,
             opt => opt.ResolveUsing(src => GetValueWithFallback(src, "dedicated", "ds").TryInt() == 1))
         .ForMember(x => x.NumPlayers,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("numplayers").TryInt()))
         .ForMember(x => x.MaxPlayers,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("maxplayers").TryInt()))
         .ForMember(x => x.Difficulty,
             opt => opt.ResolveUsing(src => GetValueWithFallback(src, "difficulty", "diff").TryInt()))
         .ForMember(x => x.GameState,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("gameState").TryInt()))
         .ForMember(x => x.VerifySignatures,
             opt => opt.ResolveUsing(src => GetValueWithFallback(src, "verifySignatures", "verSig").TryInt()))
         .ForMember(x => x.SvBattleye,
             opt => opt.ResolveUsing(src => GetValueWithFallback(src, "sv_battleye", "be").TryInt()))
         .ForMember(x => x.ReqBuild,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("reqBuild").TryIntNullable()))
         .ForMember(x => x.PasswordRequired,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("password").TryInt() > 0))
         .ForMember(x => x.Mission, opt => opt.ResolveUsing(src => src.GetSettingOrDefault("mission")))
         .ForMember(x => x.Island,
             opt => opt.ResolveUsing(src => CapitalizeString(src.GetSettingOrDefault("mapname"))))
         .ForMember(x => x.GameType, opt => opt.ResolveUsing(src => {
             var str = CapitalizeString(src.GetSettingOrDefault("gametype"));
             return string.IsNullOrWhiteSpace(str) ? "Unknown" : str;
         }))
         .ForMember(x => x.GameName, opt => opt.ResolveUsing(src => src.GetSettingOrDefault("gamename")))
         .ForMember(x => x.GameVer,
             opt => opt.ResolveUsing(src => GetVersion(src.GetSettingOrDefault("gamever"))))
         .ForMember(x => x.Signatures,
             opt => opt.ResolveUsing(src => GetValueWithFallback(src, "signatures", "sig").TrySplit(';')))
         .AfterMap(GamespyAfterMap);
 }
Exemplo n.º 3
0
 private static void CreateMappings(IProfileExpression configuration, IEnumerable<TypesMap> maps)
 {
     foreach (var map in maps)
     {
         configuration.CreateMap(map.Source, map.Destination);
     }
 }
 public void CreateMap(IProfileExpression profileExpression)
 {
     profileExpression.CreateMap<IndexModel, Email>()
         .ForMember(d => d.FromEmailAddress, opt => opt.MapFrom(s => s.EmailAddress))
         .ForMember(d => d.ToEmailAddress, opt => opt.MapFrom(s => "*****@*****.**"))
         .ForMember(d => d.Subject, opt => opt.MapFrom(s => string.Format("prerit.com user, '{0}', is contacting you", s.Name)));
 }
Exemplo n.º 5
0
        public void CreateMap(IProfileExpression mapper)
        {
            //Mapper.CreateMap<Scheduler, SchedulerDto>();

            // design-time helper
            // throws a compiler exception if any fields in the destination aren't mapped.
            Mapper.AssertConfigurationIsValid();
        }
Exemplo n.º 6
0
        public void CreateMap(IProfileExpression mapper)
        {
            mapper.CreateMap<Post, PostModel>();
            mapper.CreateMap<PostModel, Post>();

            mapper.CreateMap<Comment, CommentModel>();
            mapper.CreateMap<CommentModel, Comment>();
        }
Exemplo n.º 7
0
        public void CreateMap(IProfileExpression mapper)
        {
            mapper.CreateMap<Content.Content, ContentViewModel>();
            mapper.CreateMap<ContentViewModel, Content.Content>();

            mapper.CreateMap<Page, PageViewModel>();
            mapper.CreateMap<PageViewModel, Page>();
        }
        void CreateGameMap(IProfileExpression config) {
            config.CreateMap<InstalledState, GameDataModel>();
            config.CreateMap<GameMetaData, GameDataModel>();
            config.CreateMap<Game, GameDataModel>()
                .AfterMap(AfterGameDataModelMap);

            CreateGameSettingsMap(config);
        }
Exemplo n.º 9
0
        public void CreateMap(IProfileExpression mapper)
        {
            mapper.CreateMap<FacadeDto, FacadeBmo>(); //<-- Entity to Model

            //mapper.CreateMap<SchedulerDto, SchedulerBmo>(); //<-- Dto to Model

            // design-time helper
            // throws a compiler exception if any fields in the destination aren't mapped.
            Mapper.AssertConfigurationIsValid();
        }
        static void SetupApiModels(IProfileExpression cfg) {
            cfg.CreateMap<GTA4GameSettings, GTA4GameSettingsApiModel>()
                .IncludeBase<GameSettings, GameSettingsApiModel>();
            cfg.CreateMap<GTA4GameSettingsApiModel, GTA4GameSettings>()
                .IncludeBase<GameSettingsApiModel, GameSettings>();

            cfg.CreateMap<GTA5GameSettings, GTA5GameSettingsApiModel>()
                .IncludeBase<GameSettings, GameSettingsApiModel>();
            cfg.CreateMap<GTA5GameSettingsApiModel, GTA5GameSettings>()
                .IncludeBase<GameSettingsApiModel, GameSettings>();
        }
Exemplo n.º 11
0
        void CreateGameSettingsMap(IProfileExpression config) {
            config.CreateMap<GameSettings, GameSettingsDataModel>()
                .Include<RealVirtualitySettings, RealVirtualityGameSettingsDataModel>()
                .Include<Homeworld2Settings, HomeWorld2SettingsDataModel>()
                .Include<GTAVSettings, GTAVSettingsDataModel>();

            config.CreateMap<RealVirtualitySettings, RealVirtualityGameSettingsDataModel>()
                .Include<ArmaSettings, ArmaSettingsDataModel>();

            config.CreateMap<Arma2FreeSettings, Arma2OriginalChildSettingsDataModel>();

            config.CreateMap<ArmaSettings, ArmaSettingsDataModel>()
                .Include<Arma2OaSettings, Arma2OaSettingsDataModel>();
            config.CreateMap<ArmaSettings, Arma2OriginalChildSettingsDataModel>();
            config.CreateMap<Arma2OaSettings, Arma2OaSettingsDataModel>()
                .Include<Arma3Settings, Arma3SettingsDataModel>()
                .Include<Arma2CoSettings, Arma2CoSettingsDataModel>();
            config.CreateMap<Arma2CoSettings, Arma2CoSettingsDataModel>()
                .ForMember(x => x.Arma2Free, opt => opt.Ignore())
                .ForMember(x => x.Arma2Original, opt => opt.Ignore())
                .AfterMap(AfterCoMap);

            config.CreateMap<Arma3Settings, Arma3SettingsDataModel>();
            config.CreateMap<Homeworld2Settings, HomeWorld2SettingsDataModel>();
            config.CreateMap<GTAVSettings, GTAVSettingsDataModel>();

            config.CreateMap<GameSettingsDataModel, GameSettings>()
                .Include<RealVirtualityGameSettingsDataModel, RealVirtualitySettings>()
                .Include<HomeWorld2SettingsDataModel, Homeworld2Settings>()
                .Include<GTAVSettingsDataModel, GTAVSettings>();

            config.CreateMap<RealVirtualityGameSettingsDataModel, RealVirtualitySettings>()
                .Include<ArmaSettingsDataModel, ArmaSettings>();
            config.CreateMap<ArmaSettingsDataModel, ArmaSettings>()
                .Include<Arma2OaSettingsDataModel, Arma2OaSettings>();
            config.CreateMap<Arma2OaSettingsDataModel, Arma2OaSettings>()
                .Include<Arma3SettingsDataModel, Arma3Settings>()
                .Include<Arma2CoSettingsDataModel, Arma2CoSettings>();
            config.CreateMap<Arma3SettingsDataModel, Arma3Settings>();
            config.CreateMap<Arma2CoSettingsDataModel, Arma2CoSettings>()
                .ForMember(x => x.Arma2Free, opt => opt.Ignore())
                .ForMember(x => x.Arma2Original, opt => opt.Ignore())
                .AfterMap(AfterCoRevMap);

            config.CreateMap<Arma2OriginalChildSettingsDataModel, ArmaSettings>();
            config.CreateMap<Arma2OriginalChildSettingsDataModel, Arma2FreeSettings>();

            config.CreateMap<HomeWorld2SettingsDataModel, Homeworld2Settings>();
            config.CreateMap<GTAVSettingsDataModel, GTAVSettings>();
        }
Exemplo n.º 12
0
        public static void ConfigureMapping(IProfileExpression config)
        {
            config.CreateMap<Transaction, TransactionViewModel>()
                .ForMember(t => t.FromId, opts => opts.MapFrom(t => t.From.Id))
                .ForMember(t => t.ToId, opts => opts.MapFrom(t => t.To.Id));
            config.CreateMap<TransactionViewModel, Transaction>();
            config.CreateMap<TransactionType, TransactionTypeViewModel>()
                .ForMember(tt => tt.FromId, opts => opts.MapFrom(tt => tt.From.Id))
                .ForMember(tt => tt.ToId, opts => opts.MapFrom(tt => tt.To.Id));
            config.CreateMap<Category, CategoryViewModel>().ForMember(vm => vm.CategoryTypeId, opts => opts.MapFrom(src => src.CategoryType.Id));
            config.CreateMap<CategoryViewModel, Category>().ForMember(c => c.Total, opts => opts.Ignore());
            config.CreateMap<CategoryType, CategoryTypeViewModel>().ReverseMap();

            config.CreateMap<Category, CategoryTreeViewModel>().ForMember(ct => ct.CategoryTypeId, opts => opts.MapFrom(src => src.CategoryType.Id));
        }
        public void CreateMap(IProfileExpression mapper)
        {
            //Items mapping

            //mapper.CreateMap<Item, ItemDetailsViewModel>();
            ////.ForMember(dest => dest.Tracks, opt => opt.MapFrom(src => src.TrackedAsLocationCollection));

            //mapper.CreateMap<Item, Item>();

            //mapper.CreateMap<Item, ItemListDto>()
            //    .ForMember(dest => dest.ObjectDetailId, opt => opt.MapFrom(src => src.ObjectDetailId))
            //    .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name))
            //    .ForMember(dest => dest.Description, opt => opt.MapFrom(src => src.Description))
            //    .ForMember(dest => dest.GroupId, opt => opt.MapFrom(src => src.GroupId))
            //    .ForMember(dest => dest.GroupName, opt => opt.MapFrom(src => src.Group.Name))
            //    .ForMember(dest => dest.ImagePath, opt => opt.MapFrom(src => src.ImagePath))
            //    .ForMember(dest => dest.ImageThumbnailPath, opt => opt.MapFrom(src => src.ImageThumbnailPath));

            //mapper.CreateMap<Track, TrackDto>();

            //mapper.CreateMap<PlaygroundReservations.Models.Item, ItemCreateViewModel>()
            //    .ForMember(dest => dest.ObjectDetailId, opt => opt.MapFrom(src => src.ObjectDetailId))
            //    .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name))
            //    .ForMember(dest => dest.Description, opt => opt.MapFrom(src => src.Description))
            //    .ForMember(dest => dest.GroupId, opt => opt.MapFrom(src => src.GroupId))
            //    .ForMember(dest => dest.GroupName, opt => opt.MapFrom(src => src.Group.Name));

            //mapper.CreateMap<ItemCreateViewModel, PlaygroundReservations.Models.Item>()
            //    .ForMember(dest => dest.ObjectDetailId, opt => opt.MapFrom(src => src.ObjectDetailId))
            //    .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name))
            //    .ForMember(dest => dest.Description, opt => opt.MapFrom(src => src.Description))
            //    .ForMember(dest => dest.GroupId, opt => opt.MapFrom(src => src.GroupId));

            ////Contacts
            //mapper.CreateMap<ContactDetailsViewModel, PlaygroundReservations.Models.Contact>();
            //mapper.CreateMap<PlaygroundReservations.Models.Contact, ContactDetailsViewModel>();

            //mapper.CreateMap<Contact, ContactListDto>();
            //mapper.CreateMap<ContactListDto, Contact>();

            ////Locations
            //mapper.CreateMap<LocationDetailsViewModel, PlaygroundReservations.Models.Location>();
            //mapper.CreateMap<PlaygroundReservations.Models.Location, LocationDetailsViewModel>();

            //mapper.CreateMap<Location, LocationListDto>();
            //mapper.CreateMap<LocationListDto, Location>();
        }
Exemplo n.º 14
0
 public static void IgnoreUnmapped <TSrc, TDest>(this IProfileExpression profile)
 {
     profile.IgnoreUnmapped(typeof(TSrc), typeof(TDest));
 }
Exemplo n.º 15
0
 public MapLoader(IProfileExpression mapperConfiguration)
 {
     this._mapperConfiguration = mapperConfiguration;
 }
 static void SetupApiModels(IProfileExpression cfg) {
     cfg.CreateMap<Witcher3GameSettings, Witcher3GameSettingsApiModel>();
     cfg.CreateMap<Witcher3GameSettingsApiModel, Witcher3GameSettings>();
 }
Exemplo n.º 17
0
 void CreateDlcMap(IProfileExpression config)
 {
     config.CreateMap <DlcMetaData, DlcDataModel>();
     config.CreateMap <Dlc, DlcDataModel>()
     .AfterMap(AfterDlcDataModelMap);
 }
 /// <summary>
 /// Ignores all unmapped members of all maps. Put this method at the end of the automapper configuration, which is configured inside the middleware
 /// </summary>
 /// <param name="profile"></param>
 public static void IgnoreUnmapped(this IProfileExpression profile)
 {
     profile.ForAllMaps(IgnoreUnmappedProperties);
 }
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration
     .CreateMap <TransportWorkTicket, TransportWortkTicketEditViewModel>()
     .ForMember(x => x.Routes, y => y.MapFrom(x => x.RouteTransportWorkTickets));
 }
Exemplo n.º 20
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <User, BannedUsersViewModel>()
     .ForMember(x => x.Name, cfg => cfg.MapFrom(y => y.FirstName + " " + y.LastName));
 }
Exemplo n.º 21
0
 void CreateProfileMap(IProfileExpression config) {
     config.CreateMap<GameSettingsProfileBase, ProfileDataModel>();
 }
Exemplo n.º 22
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <ApplicationUser, ProfileSearchViewModel>().ForMember(
         m => m.FullName,
         opt => opt.MapFrom(x => x.FirstName + " " + x.LastName));
 }
Exemplo n.º 23
0
 internal static IProfileExpression ApplyUserModelMapping(this IProfileExpression configuration)
 {
     return(configuration.ToUserModel());
 }
Exemplo n.º 24
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <Guide, EditGuideViewModel>()
     .ForMember(x => x.Content, s => s.MapFrom(x => x.Description));
 }
Exemplo n.º 25
0
        private static IProfileExpression ToUserModel(this IProfileExpression configuration)
        {
            configuration.CreateMap <User, UserModel>();

            return(configuration);
        }
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <AppUser, EmployeeInfoViewModel>()
     .ForMember(x => x.FullName,
                y => y.MapFrom(x => x.Name));
 }
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <InternalRepairServiceModel, InternalRepairAllViewModel>()
     .ForMember(d => d.Name,
                o => o.MapFrom(x => x.Name.Replace("_", " ")));
 }
Exemplo n.º 28
0
 public void Configure(IProfileExpression profile)
 {
     profile.CreateMap <AppUser, UserTitleVM>()
     .ForMember(x => x.Role, opt => opt.Ignore())
     .ForMember(x => x.FullName, opt => opt.MapFrom(y => y.FirstName + " " + y.LastName));
 }
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <Event, EventViewModel>()
     .ForMember(e => e.AuthorName, y => y.MapFrom(e => $"{e.Creator.FirstName} {e.Creator.LastName}"));
 }
Exemplo n.º 30
0
        static void SetupSource(IProfileExpression mapConfig) {
            mapConfig.CreateMap<SourceServerQueryResult, Server>()
                .ForMember(x => x.NumPlayers,
                    opt => opt.ResolveUsing(src => src.GetSettingOrDefault("playerCount").TryInt()))
                .ForMember(x => x.MaxPlayers,
                    opt => opt.ResolveUsing(src => src.GetSettingOrDefault("playerMax").TryInt()))
                .ForMember(x => x.PasswordRequired,
                    opt => opt.ResolveUsing(src => src.GetSettingOrDefault("visibility").TryInt() > 0))
                .ForMember(x => x.Mission, opt => opt.ResolveUsing(src => src.GetSettingOrDefault("game")))
                .ForMember(x => x.Island,
                    opt => opt.ResolveUsing(src => CapitalizeString(src.GetSettingOrDefault("map"))))
                .ForMember(x => x.GameName, opt => opt.ResolveUsing(src => src.GetSettingOrDefault("folder")))
                .ForMember(x => x.GameVer,
                    opt => opt.ResolveUsing(src => GetVersion(src.GetSettingOrDefault("version"))))
                .AfterMap(SourceAfterMap);

            mapConfig.CreateMap<SourceMasterServerQueryResult, Server>()
                .ForMember(x => x.GameName, opt => opt.ResolveUsing(src => src.GetSettingOrDefault("folder")))
                .AfterMap(SourceAfterMap);
        }
Exemplo n.º 31
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <ProfessorResponseModel, ProfessorResponseViewModel>()
     .ForMember(x => x.CreatedOn, opt => opt.MapFrom(x => DateTimeMapper.Map(x.CreatedOn)))
     .ForMember(x => x.ModifiedOn, opt => opt.MapFrom(x => DateTimeMapper.Map(x.ModifiedOn)));
 }
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <Setting, SettingViewModel>().ForMember(
         m => m.NameAndValue,
         opt => opt.MapFrom(x => x.Name + " = " + x.Value));
 }
Exemplo n.º 33
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration
     .CreateMap <Beat, BeatSingleCartViewModel>()
     .ForMember(a => a.ImageUrl, m => m.MapFrom(a => a.CloudinaryImage.PictureUrl));
 }
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <ManagerLog, ManagerActivitiesListingModel>()
     .ForMember(x => x.UserName, m => m.MapFrom(ml => ml.Manager.UserName));
 }
Exemplo n.º 35
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <Course, CourseViewModel>()
     .ForMember(x => x.AverageRating, opt => opt.MapFrom(c => c.Ratings.Average(r => r.Value)));
 }
Exemplo n.º 36
0
 void CreateProfileMap(IProfileExpression config)
 {
     config.CreateMap <GameSettingsProfileBase, ProfileDataModel>();
 }
Exemplo n.º 37
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <Actor, ActorViewModel>().ForMember(
         m => m.Gender,
         opt => opt.MapFrom(x => x.Gender.ToString()));
 }
Exemplo n.º 38
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <Ad, LatestAddedAdViewModel>()
     .ForMember(x => x.MainPictureUrl, cfg => cfg.MapFrom(x => x.Images.Any() ? x.Images.FirstOrDefault().ImageUrl : "/img/no-image.png"));
 }
        private static void LoadStandardFromMappings(IEnumerable<Type> types, IProfileExpression configuration)
        {
            var maps = GetFromMaps(types);

            CreateMappings(maps, configuration);
        }
 public static void IgnoreUnmapped(this IProfileExpression profile, Type src, Type dest)
 {
     profile.IgnoreUnmapped((TypeMap map) => map.SourceType == src && map.DestinationType == dest);
 }
Exemplo n.º 41
0
 /// <summary>
 /// The register mapping definitions.
 /// </summary>
 /// <param name="mapper">
 /// The mapper.
 /// </param>
 public void CreateMap(IProfileExpression mapper)
 {
     Mapper.CreateMap<DonationData, Donation>();
     Mapper.CreateMap<Donation, DonationData>();
 }
Exemplo n.º 42
0
 /// <summary>
 /// The create map.
 /// </summary>
 /// <param name="mapper">
 /// The mapper.
 /// </param>
 public void CreateMap(IProfileExpression mapper)
 {
     // TODO: Add reverse mapping.
     Mapper.CreateMap<TagData, Tag>();
     Mapper.CreateMap<Tag, TagData>();
 }
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration
     .CreateMap <BeatComment, BeatCommentResponseModel>()
     .ForMember(b => b.ImageUrl, m => m.MapFrom(b => b.User.Profile.MainPhotoUrl));
 }
Exemplo n.º 44
0
            /// <summary>
            /// The create map.
            /// </summary>
            /// <param name="mapper">
            /// The mapper.
            /// </param>
            public void CreateMap(IProfileExpression mapper)
            {
                // Domain >> EF
                mapper.CreateMap<Instance, InstanceData>();
                mapper.CreateMap<Location, InstanceData>();
                mapper.CreateMap<Address, InstanceData>();

                // EF >> Domain
                mapper.CreateMap<InstanceData, Instance>()
                    .ForMember(
                        instance => instance.Location, 
                        options => options.MapFrom(location => Mapper.Map<InstanceData, Location>(location)))
                    .ForMember(
                        instance => instance.Address, 
                        options => options.MapFrom(address => Mapper.Map<InstanceData, Address>(address)));

                mapper.CreateMap<InstanceData, Location>()
                    .ForMember(location => location.Latitude, opt => opt.MapFrom(source => source.Latitude))
                    .ForMember(location => location.Longitude, opt => opt.MapFrom(source => source.Longitude));

                mapper.CreateMap<InstanceData, Address>()
                    .ForMember(address => address.City, opt => opt.MapFrom(source => source.City))
                    .ForMember(address => address.Country, opt => opt.MapFrom(source => source.Country))
                    .ForMember(address => address.PostalCode, opt => opt.MapFrom(source => source.PostalCode))
                    .ForMember(address => address.State, opt => opt.MapFrom(source => source.State))
                    .ForMember(address => address.Street1, opt => opt.MapFrom(source => source.Street1))
                    .ForMember(address => address.Street2, opt => opt.MapFrom(source => source.Street2));
            }
Exemplo n.º 45
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <RoomType, RoomTypeCalendarViewModel>()
     .ForMember(d => d.text, o => o.MapFrom(x => x.Name))
     .ForMember(d => d.id, o => o.MapFrom(x => x.Id));
 }
 static void SetupApiModels(IProfileExpression cfg) {
     cfg.CreateMap<Homeworld2GameSettings, Homeworld2GameSettingsApiModel>()
         .IncludeBase<GameSettings, GameSettingsApiModel>();
     cfg.CreateMap<Homeworld2GameSettingsApiModel, Homeworld2GameSettings>()
         .IncludeBase<GameSettingsApiModel, GameSettings>();
 }
Exemplo n.º 47
0
 public void RegisterMappings(IProfileExpression profile)
 {
     profile.CreateMap <Entities.Album, AlbumWithImagesModel>()
     .ForMember(ai => ai.ImageIds, opts => opts.MapFrom(a => a.Images.Select(a => a.Id).ToList()));
 }
Exemplo n.º 48
0
 void CreateDlcMap(IProfileExpression config) {
     config.CreateMap<DlcMetaData, DlcDataModel>();
     config.CreateMap<Dlc, DlcDataModel>()
         .AfterMap(AfterDlcDataModelMap);
 }
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <Blog, VisualizeBlogViewModel>()
     .ForMember(x => x.ImageUrl, opt => opt.MapFrom(x =>
                                                    x.BlogImages.FirstOrDefault().RemoteImageUrl ?? "/images/blogs/" + x.BlogImages.FirstOrDefault().Id + "." + x.BlogImages.FirstOrDefault().Extension));
 }
Exemplo n.º 50
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration
     .CreateMap <ReceiptServiceModel, ReceiptDetailsViewModel>()
     .ForMember(destination => destination.Recipient, opts => opts.MapFrom(origin => origin.Recipient.UserName));
 }
Exemplo n.º 51
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <SubCategoryDisplayViewModel, SubCategory>()
     .ForMember(dest => dest.Products, opt => opt.MapFrom((src, dest) => src.ProductsCount));
 }
Exemplo n.º 52
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <AddDrinkViewModel, Drink>()
     .ForMember(x => x.Image, y => y.Ignore());
 }
Exemplo n.º 53
0
 public void CreateMappings(IProfileExpression configuration)
 {
     configuration.CreateMap <Exercise, ExerciseDto>()
     .ForMember(x => x.SecondaryMuscleGroupNames, y => y.MapFrom(x => x.SecondaryMuscleGroupExercises.Select(x => x.MuscleGroup.Name)));
 }
Exemplo n.º 54
0
        private static void RegisterStandardFromMappings(IProfileExpression configuration, IEnumerable<Type> types)
        {
            var maps = GetFromMaps(types);

            CreateMappings(configuration, maps);
        }
Exemplo n.º 55
0
 static void SetupSourceOld(IProfileExpression mapConfig) {
     mapConfig.CreateMap<SourceServerQueryResult, Server>()
         .ForMember(x => x.NumPlayers,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("playerCount").TryInt()))
         .ForMember(x => x.MaxPlayers,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("playerMax").TryInt()))
         .ForMember(x => x.Difficulty,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("difficulty").TryInt()))
         //TODO: not in steam
         .ForMember(x => x.GameState,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("gameState").TryInt()))
         //TODO: not in steam
         .ForMember(x => x.VerifySignatures,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("verifySignatures").TryInt()))
         //TODO: not in steam
         .ForMember(x => x.SvBattleye,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("sv_battleye").TryInt()))
         //TODO: not in steam
         .ForMember(x => x.ReqBuild,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("requiredBuild").TryIntNullable()))
         .ForMember(x => x.PasswordRequired,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("visibility").TryInt() > 0))
         .ForMember(x => x.Mission, opt => opt.ResolveUsing(src => src.GetSettingOrDefault("map")))
         .ForMember(x => x.Island,
             opt => opt.ResolveUsing(src => CapitalizeString(src.GetSettingOrDefault("island"))))
         .ForMember(x => x.GameType, opt => opt.ResolveUsing(src => {
             var str = CapitalizeString(src.GetSettingOrDefault("gametype"));
             return string.IsNullOrWhiteSpace(str) ? "Unknown" : str;
         }))
         //TODO: not in steam
         .ForMember(x => x.GameName, opt => opt.ResolveUsing(src => src.GetSettingOrDefault("folder")))
         .ForMember(x => x.GameVer,
             opt => opt.ResolveUsing(src => GetVersion(src.GetSettingOrDefault("version"))))
         .ForMember(x => x.Signatures,
             opt => opt.ResolveUsing(src => src.GetSettingOrDefault("keywords").TrySplit(',')))
         .AfterMap(SourceAfterMap);
 }