public static void CreateMaps(IMapperConfigurationExpression cfg)
 {
     cfg.CreateMap<Instance, Domain.Instance>()
         .ForMember(d=>d.InstanceType,o=>o.MapFrom(s=>(Domain.InstanceType)s.InstanceTypeId));
     cfg.CreateMap<InstanceUser, Domain.InstanceUser>()
         .ForMember(d=>d.Level, o=>o.MapFrom(s=>(Domain.InstanceUserLevel)s.InstanceUserLevelId));
     cfg.CreateMap<UserInstance, Domain.UserInstance>()
         .ForMember(d=>d.Type,o=>o.MapFrom(s=>(Domain.InstanceType)s.Type));
 }
        public static void Configure(IMapperConfigurationExpression cfg)
        {
            cfg.CreateMap<OrderDto, Order>()
                .ForMember(d => d.Name, opt => opt.MapFrom(s => s.FullName));

            cfg.CreateMap<Order, OrderDto>()
                .ForMember(d => d.FullName, opt => opt.MapFrom(s => s.Name));

            cfg.CreateMap<Customer, CustomerDto>()
                .ForMember(c => c.Orders, opt => opt.Ignore())
                .ReverseMap();
        }
        public static void LoadStandardMappings(IMapperConfigurationExpression config, IList<Type> types)
        {
            var mapsFrom = (from t in types
                            from i in GetInterfaces(t)
                            where IsGenericType(i) && i.GetGenericTypeDefinition() == typeof(IMapFrom<>) &&
                                  !IsAbstract(t) &&
                                  !IsInterface(t)
                            select new
                            {
                                Source = GetGenericArguments(i).First(),
                                Destination = t
                            }).ToArray();

            foreach (var map in mapsFrom)
            {
                config.CreateMap(map.Source, map.Destination);
            }

            var mapsTo = (from t in types
                          from i in GetInterfaces(t)
                          where IsGenericType(i) && i.GetGenericTypeDefinition() == typeof(IMapTo<>) &&
                                !IsAbstract(t) &&
                                !IsInterface(t)
                          select new
                          {
                              Source = t,
                              Destination = GetGenericArguments(i).First()
                          }).ToArray();

            foreach (var map in mapsTo)
            {
                config.CreateMap(map.Source, map.Destination);
            }

        }
        private void CreateCoreMappings(IMapperConfigurationExpression configuration)
        {
            var localizationContext = IocManager.Resolve<ILocalizationContext>();

            configuration.CreateMap<ILocalizableString, string>().ConvertUsing(ls => ls?.Localize(localizationContext));
            configuration.CreateMap<LocalizableString, string>().ConvertUsing(ls => ls == null ? null : localizationContext.LocalizationManager.GetString(ls));
        }
 private static void MapperConfigure(IMapperConfigurationExpression cfd)
 {
     cfd.CreateMap<Person, PersonInfoDto>(MemberList.Destination).ForMember(t => t.EmployeeBrithDate, t => t.MapFrom(src => src.Employee.BirthDate));
     cfd.CreateMap<EmailAddress, EmailDto>(MemberList.Destination).ForMember(t => t.EmailAddress, t => t.MapFrom(src => src.EmailAddress1));
     cfd.CreateMap<ShipMethod, ShipMethodDto>(MemberList.Destination);
     cfd.CreateMap<ProductListPriceHistory, ProductListPriceHistoryDto>(MemberList.Destination);
     cfd.CreateMap<Product, ProductDto>(MemberList.Destination);
     cfd.CreateMap<ProductModel, ProductModelDto>(MemberList.Destination);
     cfd.CreateMap<Product, Product2Dto>(MemberList.Destination);
 }
    public void RegisterMappings(IMapperConfigurationExpression config) {

      #region DTOs

      config.CreateMap<UpkFile, DomainUpkFile>().ForMember(dest => dest.Filename,       opt => opt.Ignore())
                                                .ForMember(dest => dest.ModdedFiles,    opt => opt.Ignore())
                                                .ForMember(dest => dest.IsModded,       opt => opt.Ignore())
                                                .ForMember(dest => dest.Header,         opt => opt.Ignore())
                                                .ForMember(dest => dest.LastAccess,     opt => opt.Ignore())
                                                .ForMember(dest => dest.GameFilename,   opt => opt.Ignore())
                                                .ForMember(dest => dest.CurrentVersion, opt => opt.Ignore())
                                                .ReverseMap();

      config.CreateMap<ExportVersion, DomainExportVersion>().ReverseMap();

      config.CreateMap<ExportType, DomainExportType>().ReverseMap();

      config.CreateMap<DomainUpkManagerException, UpkManagerException>().ForMember(dest => dest.Message,    opt => opt.MapFrom(src => src.Exception.Message))
                                                                        .ForMember(dest => dest.StackTrace, opt => opt.MapFrom(src => src.Exception.StackTrace))
                                                                        .ForMember(dest => dest.Id,         opt => opt.Ignore());

      #endregion DTOs

    }
        private void LoadReverseMappings(IEnumerable<Type> types, IMapperConfigurationExpression mapperConfiguration)
        {
            var maps = from t in types
                       from i in t.GetInterfaces()
                       where i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IMapTo<>) &&
                             !t.IsAbstract &&
                             !t.IsInterface
                       select new
                       {
                           Destination = i.GetGenericArguments()[0],
                           Source = t
                       };

            foreach (var map in maps)
            {
                mapperConfiguration.CreateMap(map.Source, map.Destination);
            }
        }
        private static void LoadStandardMappings(IEnumerable<Type> types, IMapperConfigurationExpression mapperConfiguration)
        {
            var maps = (from t in types
                        from i in t.GetInterfaces()
                        where i.GetTypeInfo().IsGenericType && i.GetGenericTypeDefinition() == typeof(IMapFrom<>) &&
                              !t.GetTypeInfo().IsAbstract &&
                              !t.GetTypeInfo().IsInterface
                        select new
                        {
                            Source = i.GetGenericArguments()[0],
                            Destination = t
                        }).ToArray();

            foreach (var map in maps)
            {
                mapperConfiguration.CreateMap(map.Source, map.Destination);
            }
        }
Exemple #9
0
 public static void Map(IMapperConfigurationExpression cfg) =>
     cfg.CreateMap<Domain.Client, Client>();
Exemple #10
0
 public void CreateMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap <App.Models.Recipe, IndexRecipeViewModel>()
     .ForMember(x => x.Url, x => x.MapFrom(r => r.SmallPictureUrl));
 }
Exemple #11
0
        public static void CreateMappings(IMapperConfigurationExpression configuration)
        {
            //Inputs
            configuration.CreateMap <CheckboxInputType, FeatureInputTypeDto>();
            configuration.CreateMap <SingleLineStringInputType, FeatureInputTypeDto>();
            configuration.CreateMap <ComboboxInputType, FeatureInputTypeDto>();
            configuration.CreateMap <IInputType, FeatureInputTypeDto>()
            .Include <CheckboxInputType, FeatureInputTypeDto>()
            .Include <SingleLineStringInputType, FeatureInputTypeDto>()
            .Include <ComboboxInputType, FeatureInputTypeDto>();
            configuration.CreateMap <StaticLocalizableComboboxItemSource, LocalizableComboboxItemSourceDto>();
            configuration.CreateMap <ILocalizableComboboxItemSource, LocalizableComboboxItemSourceDto>()
            .Include <StaticLocalizableComboboxItemSource, LocalizableComboboxItemSourceDto>();
            configuration.CreateMap <LocalizableComboboxItem, LocalizableComboboxItemDto>();
            configuration.CreateMap <ILocalizableComboboxItem, LocalizableComboboxItemDto>()
            .Include <LocalizableComboboxItem, LocalizableComboboxItemDto>();

            //Chat
            configuration.CreateMap <ChatMessage, ChatMessageDto>();
            configuration.CreateMap <ChatMessage, ChatMessageExportDto>();

            //Feature
            configuration.CreateMap <FlatFeatureSelectDto, Feature>().ReverseMap();
            configuration.CreateMap <Feature, FlatFeatureDto>();

            //Role
            configuration.CreateMap <RoleEditDto, Role>().ReverseMap();
            configuration.CreateMap <Role, RoleListDto>();
            configuration.CreateMap <UserRole, UserListRoleDto>();

            //Edition
            configuration.CreateMap <EditionEditDto, SubscribableEdition>().ReverseMap();
            configuration.CreateMap <EditionCreateDto, SubscribableEdition>();
            configuration.CreateMap <EditionSelectDto, SubscribableEdition>().ReverseMap();
            configuration.CreateMap <SubscribableEdition, EditionInfoDto>();

            configuration.CreateMap <Edition, EditionInfoDto>().Include <SubscribableEdition, EditionInfoDto>();

            configuration.CreateMap <SubscribableEdition, EditionListDto>();
            configuration.CreateMap <Edition, EditionEditDto>();
            configuration.CreateMap <Edition, SubscribableEdition>();
            configuration.CreateMap <Edition, EditionSelectDto>();


            //Payment
            configuration.CreateMap <SubscriptionPaymentDto, SubscriptionPayment>().ReverseMap();
            configuration.CreateMap <SubscriptionPaymentListDto, SubscriptionPayment>().ReverseMap();
            configuration.CreateMap <SubscriptionPayment, SubscriptionPaymentInfoDto>();

            //Permission
            configuration.CreateMap <Permission, FlatPermissionDto>();
            configuration.CreateMap <Permission, FlatPermissionWithLevelDto>();

            //Language
            configuration.CreateMap <ApplicationLanguage, ApplicationLanguageEditDto>();
            configuration.CreateMap <ApplicationLanguage, ApplicationLanguageListDto>();
            configuration.CreateMap <NotificationDefinition, NotificationSubscriptionWithDisplayNameDto>();
            configuration.CreateMap <ApplicationLanguage, ApplicationLanguageEditDto>()
            .ForMember(ldto => ldto.IsEnabled, options => options.MapFrom(l => !l.IsDisabled));

            //Tenant
            configuration.CreateMap <Tenant, RecentTenant>();
            configuration.CreateMap <Tenant, TenantLoginInfoDto>();
            configuration.CreateMap <Tenant, TenantListDto>();
            configuration.CreateMap <TenantEditDto, Tenant>().ReverseMap();
            configuration.CreateMap <CurrentTenantInfoDto, Tenant>().ReverseMap();

            //User
            configuration.CreateMap <User, UserEditDto>()
            .ForMember(dto => dto.Password, options => options.Ignore())
            .ReverseMap()
            .ForMember(user => user.Password, options => options.Ignore());
            configuration.CreateMap <User, UserLoginInfoDto>();
            configuration.CreateMap <User, UserListDto>();
            configuration.CreateMap <User, ChatUserDto>();
            configuration.CreateMap <User, OrganizationUnitUserListDto>();
            configuration.CreateMap <Role, OrganizationUnitRoleListDto>();
            configuration.CreateMap <CurrentUserProfileEditDto, User>().ReverseMap();
            configuration.CreateMap <UserLoginAttemptDto, UserLoginAttempt>().ReverseMap();
            configuration.CreateMap <ImportUserDto, User>();

            //AuditLog
            configuration.CreateMap <AuditLog, AuditLogListDto>();
            configuration.CreateMap <EntityChange, EntityChangeListDto>();
            configuration.CreateMap <EntityPropertyChange, EntityPropertyChangeDto>();

            //Friendship
            configuration.CreateMap <Friendship, FriendDto>();
            configuration.CreateMap <FriendCacheItem, FriendDto>();

            //OrganizationUnit
            configuration.CreateMap <OrganizationUnit, OrganizationUnitDto>();

            //Webhooks
            configuration.CreateMap <WebhookSubscription, GetAllSubscriptionsOutput>();
            configuration.CreateMap <WebhookSendAttempt, GetAllSendAttemptsOutput>()
            .ForMember(webhookSendAttemptListDto => webhookSendAttemptListDto.WebhookName,
                       options => options.MapFrom(l => l.WebhookEvent.WebhookName))
            .ForMember(webhookSendAttemptListDto => webhookSendAttemptListDto.Data,
                       options => options.MapFrom(l => l.WebhookEvent.Data));

            configuration.CreateMap <WebhookSendAttempt, GetAllSendAttemptsOfWebhookEventOutput>();

            configuration.CreateMap <DynamicParameter, DynamicParameterDto>().ReverseMap();
            configuration.CreateMap <DynamicParameterValue, DynamicParameterValueDto>().ReverseMap();
            configuration.CreateMap <EntityDynamicParameter, EntityDynamicParameterDto>()
            .ForMember(dto => dto.DynamicParameterName,
                       options => options.MapFrom(entity => entity.DynamicParameter.ParameterName));
            configuration.CreateMap <EntityDynamicParameterDto, EntityDynamicParameter>();

            configuration.CreateMap <EntityDynamicParameterValue, EntityDynamicParameterValueDto>().ReverseMap();
            //User Delegations
            configuration.CreateMap <CreateUserDelegationDto, UserDelegation>();


            /* ADD YOUR OWN CUSTOM AUTOMAPPER MAPPINGS HERE */
        }
 public void CreateMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap <Comments, CreateCommentViewModel>()
     .ForMember(commentModel => commentModel.UserName, cfg => cfg.MapFrom(comment => comment.User.UserName))
     .ForMember(commentModel => commentModel.MovieId, cfg => cfg.MapFrom(comment => comment.Movie.Id));
 }
 private static void Configure(IMapperConfigurationExpression mapperConfiguration)
 {
     mapperConfiguration.CreateMissingTypeMaps = true;
     mapperConfiguration.CreateMap <CarAdvert, CarAdvertDto>().ReverseMap();
 }
Exemple #14
0
 public void ConfigureMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap <ApplicationUser, UserViewModel>().ForMember(
         dest => dest.Username,
         mo => { mo.MapFrom(src => src.UserName); });
 }
        public static void Configuration(IMapperConfigurationExpression x)
        {
            #region Member

            x.CreateMap <Member, MemberAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.username, (map) => map.MapFrom(obj => obj.name))
            //.ForMember(dto => dto.password, (map) => map.MapFrom(obj => obj.password))
            .ForMember(dto => dto.personName, (map) => map.MapFrom(obj => obj.name))
            .ForMember(dto => dto.picPath, (map) => map.MapFrom(obj => obj.pic_path))
            .ForMember(dto => dto.type, (map) => map.MapFrom(obj => obj.type))
            .ForMember(dto => dto.totalAmount, (map) => map.MapFrom(obj => obj.total_amount))
            .ForMember(dto => dto.superiorAgentId, (map) => map.MapFrom(obj => obj.superior_agent_id))
            .ForMember(dto => dto.cardHolder, (map) => map.MapFrom(obj => obj.card_holder))
            .ForMember(dto => dto.cardNo, (map) => map.MapFrom(obj => obj.card_no))
            .ForMember(dto => dto.depositBank, (map) => map.MapFrom(obj => obj.deposit_bank))
            .ForMember(dto => dto.depositBranchBank, (map) => map.MapFrom(obj => obj.deposit_branch_bank))
            .ForMember(dto => dto.regTime, (map) => map.MapFrom(obj => obj.reg_time))
            .ForMember(dto => dto.totalPoint, (map) => map.MapFrom(obj => obj.total_point))
            .ForMember(dto => dto.updateTime, (map) => map.MapFrom(obj => obj.update_time == null?null: obj.update_time.Value.ToString("yyyy-MM-dd HH:mm:ss")))
            .ForMember(dto => dto.secretStatus, (map) => map.MapFrom(obj => obj.secret_status))
            .ForMember(dto => dto.status, (map) => map.MapFrom(obj => obj.status));

            x.CreateMap <MemberAppDto, Member>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.name, (map) => map.MapFrom(obj => obj.username))
            //.ForMember(dto => dto.password, (map) => map.MapFrom(obj => obj.password))
            .ForMember(dto => dto.name, (map) => map.MapFrom(obj => obj.personName))
            .ForMember(dto => dto.pic_path, (map) => map.MapFrom(obj => obj.picPath))
            .ForMember(dto => dto.type, (map) => map.MapFrom(obj => obj.type))
            .ForMember(dto => dto.total_amount, (map) => map.MapFrom(obj => obj.totalAmount))
            .ForMember(dto => dto.superior_agent_id, (map) => map.MapFrom(obj => obj.superiorAgentId))
            .ForMember(dto => dto.card_holder, (map) => map.MapFrom(obj => obj.cardHolder))
            .ForMember(dto => dto.card_no, (map) => map.MapFrom(obj => obj.cardNo))
            .ForMember(dto => dto.deposit_bank, (map) => map.MapFrom(obj => obj.depositBank))
            .ForMember(dto => dto.deposit_branch_bank, (map) => map.MapFrom(obj => obj.depositBranchBank))
            .ForMember(dto => dto.reg_time, (map) => map.MapFrom(obj => obj.regTime))
            .ForMember(dto => dto.total_point, (map) => map.MapFrom(obj => obj.totalPoint))
            .ForMember(dto => dto.update_time, (map) => map.MapFrom(obj => obj.updateTime))
            .ForMember(dto => dto.secret_status, (map) => map.MapFrom(obj => obj.secretStatus))
            .ForMember(dto => dto.status, (map) => map.MapFrom(obj => obj.status));

            #endregion

            #region Point

            x.CreateMap <Point_Exchange, PointExchangeAppDto>()
            .ForMember(dto => dto.Id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.exchangeId, (map) => map.MapFrom(obj => obj.member_id))
            .ForMember(dto => dto.exchangeName, (map) => map.MapFrom(obj => obj.Member.name))
            .ForMember(dto => dto.amount, (map) => map.MapFrom(obj => obj.amount))
            .ForMember(dto => dto.status, (map) => map.MapFrom(obj => obj.status))
            .ForMember(dto => dto.exchangeTime, (map) => map.MapFrom(obj => obj.exchange_time));

            #endregion

            #region MemberCouponAccount


            x.CreateMap <Member_Coupon_Account, MemberCouponAccountAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.personIdNo, (map) => map.MapFrom(obj => obj.member_id))
            .ForMember(dto => dto.isUse, (map) => map.MapFrom(obj => obj.is_use))
            .ForMember(dto => dto.useTime, (map) => map.MapFrom(obj => obj.use_time))
            .ForMember(dto => dto.couponId, (map) => map.MapFrom(obj => obj.coupon_id))
            .ForMember(dto => dto.createTime, (map) => map.MapFrom(obj => obj.create_time.ToString("yyyy-MM-dd HH:mm:ss")))
            .ForMember(dto => dto.serverTime, (map) => map.MapFrom(obj => DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")))
            .ForMember(dto => dto.couponName, (map) => map.MapFrom(obj => obj.Coupon_Info.name))
            .ForMember(dto => dto.personName, (map) => map.MapFrom(obj => obj.Member.name))
            .ForMember(dto => dto.discount, (map) => map.MapFrom(obj => obj.Coupon_Info.discount))
            .ForMember(dto => dto.startTime, (map) => map.MapFrom(obj => obj.Coupon_Info.start_time == null?null:obj.Coupon_Info.start_time.Value.ToString("yyyy-MM-dd HH:mm:ss")))
            .ForMember(dto => dto.endTime, (map) => map.MapFrom(obj => obj.Coupon_Info.end_time == null ? null : obj.Coupon_Info.end_time.Value.ToString("yyyy-MM-dd HH:mm:ss")))
            .ForMember(dto => dto.isLoseValid, (map) => map.MapFrom(obj => obj.Coupon_Info.is_lose_valid));

            #endregion

            #region MicroClassInfo

            x.CreateMap <Micro_Class_Info, MicroClassInfoAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.groupId, (map) => map.MapFrom(obj => obj.group_id))
            .ForMember(dto => dto.topicInfoTitle, (map) => map.MapFrom(obj => obj.topic_info_title))
            .ForMember(dto => dto.lecturerText, (map) => map.MapFrom(obj => obj.lecturer_text))
            .ForMember(dto => dto.mp3Url, (map) => map.MapFrom(obj => obj.mp3_url))
            .ForMember(dto => dto.mp3Duration, (map) => map.MapFrom(obj => obj.mp3_duration))
            .ForMember(dto => dto.imgUrl, (map) => map.MapFrom(obj => obj.img_url ?? ""))
            .ForMember(dto => dto.createTime, (map) => map.MapFrom(obj => obj.create_time.ToString("yyyy-MM-dd HH:mm:ss")))
            .ForMember(dto => dto.updateTime, (map) => map.MapFrom(obj => obj.update_time == null ? null : obj.update_time.Value.ToString("yyyy-MM-dd HH:mm:ss")))
            .ForMember(dto => dto.adminSys, (map) => map.MapFrom(obj => true));


            x.CreateMap <Micro_Class_Group, MicroClassGroupAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.status, (map) => map.MapFrom(obj => obj.status))
            .ForMember(dto => dto.name, (map) => map.MapFrom(obj => obj.name))
            .ForMember(dto => dto.imgUrl, (map) => map.MapFrom(obj => obj.img_url))
            .ForMember(dto => dto.createTime, (map) => map.MapFrom(obj => obj.create_time.ToString("yyyy-MM-dd HH:mm:ss")))
            .ForMember(dto => dto.updateTime, (map) => map.MapFrom(obj => obj.update_time == null ? null : obj.update_time.Value.ToString("yyyy-MM-dd HH:mm:ss")));
            #endregion

            #region Product
            x.CreateMap <Product_Info, ProductInfoAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.productCode, (map) => map.MapFrom(obj => obj.product_code))
            .ForMember(dto => dto.productName, (map) => map.MapFrom(obj => obj.product_name))
            //.ForMember(dto => dto.CategoryId, (map) => map.MapFrom(obj => obj.CategoryId))
            .ForMember(dto => dto.thumbPic, (map) => map.MapFrom(obj => obj.thumb_pic))
            .ForMember(dto => dto.memberPrice, (map) => map.MapFrom(obj => obj.member_price))
            .ForMember(dto => dto.summary, (map) => map.MapFrom(obj => obj.summary))
            .ForMember(dto => dto.descUrl, (map) => map.MapFrom(obj => obj.desc_url))
            .ForMember(dto => dto.costPrice, (map) => map.MapFrom(obj => obj.cost_price))
            .ForMember(dto => dto.realPrice, (map) => map.MapFrom(obj => obj.real_price))
            .ForMember(dto => dto.firstDistributionPrice, (map) => map.MapFrom(obj => obj.first_distribution_price))
            .ForMember(dto => dto.secondDistributionPrice, (map) => map.MapFrom(obj => obj.second_distribution_price))
            .ForMember(dto => dto.salesNum, (map) => map.MapFrom(obj => obj.sales_num))
            .ForMember(dto => dto.stock, (map) => map.MapFrom(obj => obj.stock))
            .ForMember(dto => dto.status, (map) => map.MapFrom(obj => obj.status))
            .ForMember(dto => dto.serialNo, (map) => map.MapFrom(obj => obj.serial_no))
            .ForMember(dto => dto.picUrl, (map) => map.MapFrom(obj => obj.pic_url))
            .ForMember(dto => dto.videoUrl, (map) => map.MapFrom(obj => obj.video_url))
            .ForMember(dto => dto.createDateTime, (map) => map.MapFrom(obj => obj.create_date_time))
            .ForMember(dto => dto.modifyDateTime, (map) => map.MapFrom(obj => obj.modify_date_time))
            //.ForMember(dto => dto.modifyPerson, (map) => map.MapFrom(obj => obj.Modify_User.name))
            .ForMember(dto => dto.attributeList, (map) => map.MapFrom(obj => obj.Product_Attribute))
            .ForMember(dto => dto.productCategoryList, (map) => map.MapFrom(obj => obj.Product_Category))
            .ForMember(dto => dto.white, (map) => map.MapFrom(obj => obj.star_white))
            .ForMember(dto => dto.granularity, (map) => map.MapFrom(obj => obj.star_granularity))
            .ForMember(dto => dto.defect, (map) => map.MapFrom(obj => obj.star_defect))
            .ForMember(dto => dto.oily, (map) => map.MapFrom(obj => obj.star_oily));

            x.CreateMap <Product_Pictures, ProductPictureAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.picUrl, (map) => map.MapFrom(obj => obj.pic_url))
            .ForMember(dto => dto.productId, (map) => map.MapFrom(obj => obj.product_id))
            .ForMember(dto => dto.serialNo, (map) => map.MapFrom(obj => obj.serial_no))
            .ForMember(dto => dto.videoUrl, (map) => map.MapFrom(obj => obj.video_url));

            x.CreateMap <Product_Category, ProductCategoryAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.categoryName, (map) => map.MapFrom(obj => obj.category_name))
            .ForMember(dto => dto.imgUrl, (map) => map.MapFrom(obj => obj.img_url))
            .ForMember(dto => dto.parentId, (map) => map.MapFrom(obj => obj.parent_id))
            .ForMember(dto => dto.serialNo, (map) => map.MapFrom(obj => obj.serial_no))
            .ForMember(dto => dto.childCategoryList, (map) => map.MapFrom(obj => obj.Product_CategoryChild));

            x.CreateMap <Product_Category, ProductCategoryInAttributeAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.categoryName, (map) => map.MapFrom(obj => obj.category_name))
            .ForMember(dto => dto.imgUrl, (map) => map.MapFrom(obj => obj.img_url))
            .ForMember(dto => dto.parentId, (map) => map.MapFrom(obj => obj.parent_id))
            .ForMember(dto => dto.serialNo, (map) => map.MapFrom(obj => obj.serial_no));

            x.CreateMap <Product_Category, ProductCategorySimpleAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.categoryName, (map) => map.MapFrom(obj => obj.category_name))
            .ForMember(dto => dto.imgUrl, (map) => map.MapFrom(obj => obj.img_url))
            .ForMember(dto => dto.parentId, (map) => map.MapFrom(obj => obj.parent_id))
            .ForMember(dto => dto.serialNo, (map) => map.MapFrom(obj => obj.serial_no));

            x.CreateMap <Product_Group, ProductGroupAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.groupName, (map) => map.MapFrom(obj => obj.group_name))
            .ForMember(dto => dto.groupDesc, (map) => map.MapFrom(obj => obj.group_desc))
            .ForMember(dto => dto.serialNo, (map) => map.MapFrom(obj => obj.serial_no));


            x.CreateMap <Product_Attribute, ProductAttributeAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.attributeName, (map) => map.MapFrom(obj => obj.attribute_name))
            .ForMember(dto => dto.serialNo, (map) => map.MapFrom(obj => obj.serial_no))
            .ForMember(dto => dto.parentId, (map) => map.MapFrom(obj => obj.parent_id))
            .ForMember(dto => dto.inputType, (map) => map.MapFrom(obj => obj.input_type))
            .ForMember(dto => dto.categoryId, (map) => map.MapFrom(obj => obj.category_id))
            .ForMember(dto => dto.childAttributeList, (map) => map.MapFrom(obj => obj.Product_AttributeChild))
            .ForMember(dto => dto.productCategory, (map) => map.MapFrom(obj => obj.Product_Category));

            x.CreateMap <Product_Attribute, ProductAttributeSimpleAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.attributeName, (map) => map.MapFrom(obj => obj.attribute_name))
            .ForMember(dto => dto.serialNo, (map) => map.MapFrom(obj => obj.serial_no))
            .ForMember(dto => dto.parentId, (map) => map.MapFrom(obj => obj.parent_id))
            .ForMember(dto => dto.inputType, (map) => map.MapFrom(obj => obj.input_type))
            .ForMember(dto => dto.categoryId, (map) => map.MapFrom(obj => obj.category_id));

            #endregion

            #region Order

            x.CreateMap <Product_Order_Record, ProductOrderRecordAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.orderId, (map) => map.MapFrom(obj => obj.order_id))
            .ForMember(dto => dto.modifyComment, (map) => map.MapFrom(obj => obj.modify_comment))
            .ForMember(dto => dto.modifyUserId, (map) => map.MapFrom(obj => obj.modify_user_id))
            .ForMember(dto => dto.modifyDateTime, (map) => map.MapFrom(obj => obj.modify_date_time.ToString("yyyy-MM-dd HH:mm:ss")));

            x.CreateMap <Product_Order_Detail, ProductOrderDetailAppDto>()
            .ForMember(dto => dto.Id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.orderIdNo, (map) => map.MapFrom(obj => obj.order_id))
            //.ForMember(dto => dto.CategoryId, (map) => map.MapFrom(obj => obj.))
            .ForMember(dto => dto.productCode, (map) => map.MapFrom(obj => obj.product_code))
            .ForMember(dto => dto.productName, (map) => map.MapFrom(obj => obj.product_name))
            .ForMember(dto => dto.thumbPic, (map) => map.MapFrom(obj => obj.thumb_pic))
            .ForMember(dto => dto.buyNum, (map) => map.MapFrom(obj => obj.buy_num))
            .ForMember(dto => dto.summary, (map) => map.MapFrom(obj => obj.summary))
            .ForMember(dto => dto.descUrl, (map) => map.MapFrom(obj => obj.desc_url))
            .ForMember(dto => dto.costPrice, (map) => map.MapFrom(obj => obj.cost_price))
            .ForMember(dto => dto.currentPrice, (map) => map.MapFrom(obj => obj.current_price))
            .ForMember(dto => dto.firstDistributionPrice, (map) => map.MapFrom(obj => obj.first_distribution_price))
            .ForMember(dto => dto.secondDistributionPrice, (map) => map.MapFrom(obj => obj.second_distribution_price))
            .ForMember(dto => dto.memberPrice, (map) => map.MapFrom(obj => obj.member_price))
            .ForMember(dto => dto.isReceiving, (map) => map.MapFrom(obj => obj.is_receiving))
            .ForMember(dto => dto.couponAccountId, (map) => map.MapFrom(obj => obj.coupon_id))
            .ForMember(dto => dto.couponName, (map) => map.MapFrom(obj => obj.coupon_name))
            .ForMember(dto => dto.couponSalePrice, (map) => map.MapFrom(obj => obj.coupon_sale_price))
            .ForMember(dto => dto.couponId, (map) => map.MapFrom(obj => obj.Member_Coupon_Account.coupon_id));

            x.CreateMap <ProductOrderDetailAppDto, Product_Order_Detail>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.Id))
            .ForMember(dto => dto.order_id, (map) => map.MapFrom(obj => obj.orderIdNo))
            .ForMember(dto => dto.product_id, (map) => map.MapFrom(obj => obj.productId))
            .ForMember(dto => dto.product_code, (map) => map.MapFrom(obj => obj.productCode))
            .ForMember(dto => dto.product_name, (map) => map.MapFrom(obj => obj.productName))
            .ForMember(dto => dto.thumb_pic, (map) => map.MapFrom(obj => obj.thumbPic))
            .ForMember(dto => dto.buy_num, (map) => map.MapFrom(obj => obj.buyNum))
            .ForMember(dto => dto.summary, (map) => map.MapFrom(obj => obj.summary))
            .ForMember(dto => dto.desc_url, (map) => map.MapFrom(obj => obj.descUrl))
            .ForMember(dto => dto.cost_price, (map) => map.MapFrom(obj => obj.costPrice))
            .ForMember(dto => dto.current_price, (map) => map.MapFrom(obj => obj.currentPrice))
            .ForMember(dto => dto.first_distribution_price, (map) => map.MapFrom(obj => obj.firstDistributionPrice))
            .ForMember(dto => dto.second_distribution_price, (map) => map.MapFrom(obj => obj.secondDistributionPrice))
            .ForMember(dto => dto.member_price, (map) => map.MapFrom(obj => obj.memberPrice))
            .ForMember(dto => dto.coupon_id, (map) => map.MapFrom(obj => obj.couponAccountId))
            .ForMember(dto => dto.coupon_name, (map) => map.MapFrom(obj => obj.couponName))
            .ForMember(dto => dto.coupon_sale_price, (map) => map.MapFrom(obj => obj.couponSalePrice));

            x.CreateMap <Product_Order_Master, ProductOrderMasterAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.personIdNo, (map) => map.MapFrom(obj => obj.member_id))
            .ForMember(dto => dto.memberId, (map) => map.MapFrom(obj => obj.member_id))
            .ForMember(dto => dto.consignee, (map) => map.MapFrom(obj => obj.consignee))
            .ForMember(dto => dto.consigneeAddress, (map) => map.MapFrom(obj => obj.consignee_address))
            .ForMember(dto => dto.consigneePhone, (map) => map.MapFrom(obj => obj.consignee_phone))
            .ForMember(dto => dto.orderPrice, (map) => map.MapFrom(obj => obj.order_price))
            .ForMember(dto => dto.productNum, (map) => map.MapFrom(obj => obj.product_num))
            .ForMember(dto => dto.currentStatus, (map) => map.MapFrom(obj => obj.current_status))
            .ForMember(dto => dto.transportNo, (map) => map.MapFrom(obj => obj.transport_no ?? ""))
            .ForMember(dto => dto.transportCompany, (map) => map.MapFrom(obj => obj.transport_company ?? ""))
            .ForMember(dto => dto.orderDateTime, (map) => map.MapFrom(obj => obj.order_date_time))
            .ForMember(dto => dto.paymentDateTime, (map) => map.MapFrom(obj => obj.payment_date_time))
            .ForMember(dto => dto.refundDateTime, (map) => map.MapFrom(obj => obj.refund_date_time))
            .ForMember(dto => dto.totalRebateAmount, (map) => map.MapFrom(obj => obj.total_Rebate_Amount))
            .ForMember(dto => dto.superiorRebateAmount, (map) => map.MapFrom(obj => obj.superior_Rebate_Amount))
            .ForMember(dto => dto.superiorParentRebateAmount, (map) => map.MapFrom(obj => obj.superior_Parent_Rebate_Amount))
            .ForMember(dto => dto.receivingRealPrice, (map) => map.MapFrom(obj => obj.receiving_real_price))
            .ForMember(dto => dto.realTotalPrice, (map) => map.MapFrom(obj => obj.real_total_price))
            .ForMember(dto => dto.productOrderRecordList, (map) => map.MapFrom(obj => obj.Product_Order_Record))
            .ForMember(dto => dto.productOrderDetailList, (map) => map.MapFrom(obj => obj.Product_Order_Detail));


            x.CreateMap <ProductOrderMasterAppDto, Product_Order_Master>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.member_id, (map) => map.MapFrom(obj => obj.memberId))
            .ForMember(dto => dto.consignee, (map) => map.MapFrom(obj => obj.consignee))
            .ForMember(dto => dto.consignee_address, (map) => map.MapFrom(obj => obj.consigneeAddress))
            .ForMember(dto => dto.consignee_phone, (map) => map.MapFrom(obj => obj.consigneePhone))
            .ForMember(dto => dto.order_price, (map) => map.MapFrom(obj => obj.orderPrice))
            .ForMember(dto => dto.product_num, (map) => map.MapFrom(obj => obj.productNum))
            .ForMember(dto => dto.current_status, (map) => map.MapFrom(obj => obj.currentStatus))
            .ForMember(dto => dto.transport_no, (map) => map.MapFrom(obj => obj.transportNo))
            .ForMember(dto => dto.transport_company, (map) => map.MapFrom(obj => obj.transportCompany))
            .ForMember(dto => dto.order_date_time, (map) => map.MapFrom(obj => obj.orderDateTime))
            .ForMember(dto => dto.payment_date_time, (map) => map.MapFrom(obj => obj.paymentDateTime))
            .ForMember(dto => dto.refund_date_time, (map) => map.MapFrom(obj => obj.refundDateTime))
            .ForMember(dto => dto.Product_Order_Detail, (map) => map.MapFrom(obj => obj.productOrderDetailList));


            #endregion

            #region OrderRebate
            x.CreateMap <Order_Rebate_New, OrderRebateAppDto>()
            .ForMember(dto => dto.id, (map) => map.MapFrom(obj => obj.id))
            .ForMember(dto => dto.reciverId, (map) => map.MapFrom(obj => obj.reciver_id))
            .ForMember(dto => dto.reciverRebate, (map) => map.MapFrom(obj => obj.reciver_rebate))
            .ForMember(dto => dto.reciverLevel, (map) => map.MapFrom(obj => obj.reciver_level))
            .ForMember(dto => dto.giverId, (map) => map.MapFrom(obj => obj.giver_id))
            .ForMember(dto => dto.giverName, (map) => map.MapFrom(obj => obj.Giver.name))
            .ForMember(dto => dto.status, (map) => map.MapFrom(obj => obj.status))
            .ForMember(dto => dto.reason, (map) => map.MapFrom(obj => obj.reason))
            .ForMember(dto => dto.rebateTime, (map) => map.MapFrom(obj => obj.rebate_time.ToString("yyyy-MM-dd HH:mm:ss")))
            .ForMember(dto => dto.updateTime, (map) => map.MapFrom(obj => obj.update_time == null?null: obj.update_time.Value.ToString("yyyy-MM-dd HH:mm:ss")));
            #endregion
        }
 public void CreateMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap <Comment, CommentViewModel>()
     .ForMember(x => x.Author, opt => opt.MapFrom(x => x.Author.UserName))
     .ForMember(x => x.Subject, opt => opt.MapFrom(x => x.Subject.TripName));
 }
 public static void CreateMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap <User, UserDto>()
     .ForMember(dto => dto.Roles, options => options.Ignore())
     .ForMember(dto => dto.OrganizationUnits, options => options.Ignore());
 }
 internal static void ApplyMappingConfiguration(IMapperConfigurationExpression config)
 {
     config.CreateMap <Core.Income, IncomeDto>();
 }
Exemple #19
0
 public void CreateMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap <Category, ListCategoriesViewModel>()
     .ForMember(x => x.ImageToView, opt => opt.MapFrom(x => x.Image.ToStringImage()));
 }
Exemple #20
0
 public static void MapPaggedResults <TSource, TDestination>(this IMapperConfigurationExpression exp)
 {
     exp.CreateMap(typeof(PaggedResults <TSource>), typeof(IPaggedResults <TDestination>))
     .ConstructUsing((source, ctx) => { return(ctx.Mapper.Map <PaggedResults <TDestination> >(source) as IPaggedResults <TDestination>); });
 }
 protected void MapBaseObjects(IMapperConfigurationExpression cfg)
 {
     cfg.CreateMap <LegalCustomerHistory, LegalCustomerHistory>();
     cfg.CreateMap <AsCustomerHistory, AsCustomerHistory>();
 }
 public void CreateMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap <Post, PostDetailsViewModel>()
     .ForMember(d => d.Comments, opt => opt.MapFrom(s => s.Comments.OrderBy(x => x.CreatedOn)))
     .ForMember(d => d.AddComment, opt => opt.MapFrom(s => s));
 }
 public static void CreateMaps(IMapperConfigurationExpression cfg)
 {
     cfg.CreateMap<Domain.Instance, Instance>()
         .ForMember(d => d.InstanceTypeId, o => o.MapFrom(s => (int)s.InstanceType))
         .ForMember(d => d.InstanceUsers, o => o.Ignore());
 }
Exemple #24
0
 public void Mapping(IMapperConfigurationExpression config)
 {
     config.CreateMap <AddQuestionRequest, Entity.Question>();
 }
Exemple #25
0
 internal static void Map(IMapperConfigurationExpression cfg)
 {
     cfg.CreateMap <LoggerDeploymentDefinition, LoggerProperties>();
 }
 public void Map(IMapperConfigurationExpression cfg) =>
 cfg.CreateMap <CreateCustomer, Domain.Models.Customer>()
 .ConstructUsing(c =>
                 new Domain.Models.Customer(
                     c.FirstName, c.LastName, c.Email, c.BirthDate))
 .IgnoreAllPropertiesWithAnInaccessibleSetter();
Exemple #27
0
 public static void ConfigureMapping(IMapperConfigurationExpression config)
 {
     config.CreateMap <Disease, DiseaseDto>()
     .ForMember(dest => dest.DiseaseToSympthomDtos, opt => opt.MapFrom(src => src.DiseaseToSympthoms))
     .ReverseMap();
     config.CreateMap <DiseaseToSympthom, DiseaseToSympthomDto>().ReverseMap();
     config.CreateMap <DiseaseToHealthCard, DiseaseToHealthCardDto>().ReverseMap();
     config.CreateMap <DoctorToPatient, DoctorToPatientDto>().ReverseMap();
     config.CreateMap <Doctor, DoctorDto>();
     config.CreateMap <DoctorDto, Doctor>()
     .ForMember(dest => dest.DoctorToPatients, opt => opt.Ignore())
     .ForMember(dest => dest.Id, opt => opt.Ignore())
     .ForMember(dest => dest.AccessRights, opt => opt.Ignore())
     .ForMember(dest => dest.PasswordHash, opt => opt.Ignore())
     .ForMember(dest => dest.PasswordSalt, opt => opt.Ignore());
     config.CreateMap <HealthCard, HealthCardDto>()
     .ForMember(dest => dest.PatientDto, opt => opt.MapFrom(src => src.Patient))
     .ForMember(dest => dest.DiseaseToHealthCardDtos, opt => opt.MapFrom(src => src.DiseaseToHealthCard));
     config.CreateMap <HealthCardDto, HealthCard>()
     .ForMember(dest => dest.Patient, opt => opt.MapFrom(src => src.PatientDto))
     .ForMember(dest => dest.DiseaseToHealthCard, opt => opt.Ignore());
     config.CreateMap <Patient, PatientDto>();
     config.CreateMap <PatientDto, Patient>()
     .ForMember(dest => dest.DoctorToPatients, opt => opt.Ignore())
     .ForMember(dest => dest.Id, opt => opt.Ignore())
     .ForMember(dest => dest.AccessRights, opt => opt.Ignore())
     .ForMember(dest => dest.PasswordHash, opt => opt.Ignore())
     .ForMember(dest => dest.PasswordSalt, opt => opt.Ignore());
     config.CreateMap <Sympthom, SympthomDto>()
     .ForMember(dest => dest.DiseaseToSympthomDtos, opt => opt.MapFrom(src => src.DiseaseToSympthoms))
     .ReverseMap();
     config.CreateMap <QueryResult <Disease>, QueryResultDto <DiseaseDto, DiseaseFilterDto> >();
     config.CreateMap <QueryResult <Doctor>, QueryResultDto <DoctorDto, DoctorFilterDto> >();
     config.CreateMap <QueryResult <HealthCard>, QueryResultDto <HealthCardDto, HealthCardFilterDto> >();
     config.CreateMap <QueryResult <Patient>, QueryResultDto <PatientDto, PatientFilterDto> >();
     config.CreateMap <QueryResult <Sympthom>, QueryResultDto <SympthomDto, SympthomFilterDto> >();
     config.CreateMap <QueryResult <DoctorToPatient>, QueryResultDto <DoctorToPatientDto, DoctorToPatientFilterDto> >();
 }
Exemple #28
0
        public void RegisterMappings(IMapperConfigurationExpression config)
        {
            #region Settings

            config.CreateMap <DomainSettings, SettingsDialogViewEntity>().ReverseMap();

            config.CreateMap <DomainSettings, SettingsWindowViewEntity>().ForMember(dest => dest.AreSettingsChanged, opt => opt.Ignore())
            .ForMember(dest => dest.MainWindowState, opt => opt.ResolveUsing(src => src.Maximized ? WindowState.Maximized : WindowState.Normal));

            config.CreateMap <SettingsWindowViewEntity, DomainSettings>().ForMember(dest => dest.Maximized, opt => opt.ResolveUsing(src => src.MainWindowState == WindowState.Maximized))
            .ForMember(dest => dest.PathToGame, opt => opt.Ignore())
            .ForMember(dest => dest.ExportPath, opt => opt.Ignore());

            #endregion Settings

            #region Messages

            config.CreateMap <DomainLoadProgress, LoadProgressMessage>().ForMember(dest => dest.CanAsync, opt => opt.Ignore())
            .ForMember(dest => dest.IsLocalMode, opt => opt.Ignore());

            #endregion Messages

            #region Header

            config.CreateMap <DomainHeader, HeaderViewEntity>().ForMember(dest => dest.Group, opt => opt.MapFrom(src => src.Group.String))
            .ForMember(dest => dest.Guid, opt => opt.ResolveUsing(src => new Guid(src.Guid)));

            #endregion Header

            #region Tables

            config.CreateMap <DomainExportTableEntry, ExportTableEntryViewEntity>().ForMember(dest => dest.Guid, opt => opt.ResolveUsing(src => new Guid(src.Guid)))
            .ForMember(dest => dest.ArchetypeName, opt => opt.MapFrom(src => src.ArchetypeReferenceNameIndex.Name))
            .ForMember(dest => dest.OwnerName, opt => opt.MapFrom(src => src.OwnerReferenceNameIndex.Name))
            .ForMember(dest => dest.TypeName, opt => opt.MapFrom(src => src.TypeReferenceNameIndex.Name))
            .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.NameTableIndex.Name))
            .ForMember(dest => dest.IsSelected, opt => opt.Ignore())
            .ForMember(dest => dest.IsErrored, opt => opt.Ignore());

            config.CreateMap <DomainExportTableEntry, ObjectTreeViewEntity>().ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.NameTableIndex.Name))
            .ForMember(dest => dest.IsExport, opt => opt.UseValue(true))
            .ForMember(dest => dest.IsImport, opt => opt.UseValue(false))
            .ForMember(dest => dest.IsExpanded, opt => opt.Ignore())
            .ForMember(dest => dest.IsSelected, opt => opt.Ignore())
            .ForMember(dest => dest.Parent, opt => opt.Ignore())
            .ForMember(dest => dest.Children, opt => opt.UseValue(new ObservableCollection <ObjectTreeViewEntity>()));

            config.CreateMap <DomainImportTableEntry, ImportTableEntryViewEntity>().ForMember(dest => dest.PackageName, opt => opt.MapFrom(src => src.PackageNameIndex.Name))
            .ForMember(dest => dest.TypeName, opt => opt.MapFrom(src => src.TypeNameIndex.Name))
            .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.NameTableIndex.Name))
            .ForMember(dest => dest.OwnerReferenceName, opt => opt.MapFrom(src => src.OwnerReferenceNameIndex.Name))
            .ForMember(dest => dest.IsErrored, opt => opt.Ignore())
            .ForMember(dest => dest.IsSelected, opt => opt.Ignore());

            config.CreateMap <DomainImportTableEntry, ObjectTreeViewEntity>().ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.NameTableIndex.Name))
            .ForMember(dest => dest.IsExport, opt => opt.UseValue(false))
            .ForMember(dest => dest.IsImport, opt => opt.UseValue(true))
            .ForMember(dest => dest.IsExpanded, opt => opt.Ignore())
            .ForMember(dest => dest.IsSelected, opt => opt.Ignore())
            .ForMember(dest => dest.Parent, opt => opt.Ignore())
            .ForMember(dest => dest.Children, opt => opt.UseValue(new ObservableCollection <ObjectTreeViewEntity>()));

            config.CreateMap <DomainNameTableEntry, NameTableEntryViewEntity>().ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name.String))
            .ForMember(dest => dest.IsErrored, opt => opt.Ignore())
            .ForMember(dest => dest.IsSelected, opt => opt.Ignore());

            config.CreateMap <DomainGenerationTableEntry, GenerationsTableEntryViewEntity>().ForMember(dest => dest.IsErrored, opt => opt.Ignore())
            .ForMember(dest => dest.IsSelected, opt => opt.Ignore());

            config.CreateMap <DomainCompressedChunk, CompressionTableEntryViewEntity>().ForMember(dest => dest.BlockSize, opt => opt.MapFrom(src => src.Header.BlockSize))
            .ForMember(dest => dest.CompressionBlocks, opt => opt.MapFrom(src => src.Header.Blocks))
            .ForMember(dest => dest.IsErrored, opt => opt.Ignore())
            .ForMember(dest => dest.IsSelected, opt => opt.Ignore());

            config.CreateMap <DomainCompressedChunkBlock, CompressionBlockViewEntity>().ForMember(dest => dest.IsSelected, opt => opt.Ignore());

            #endregion Tables

            #region Properties

            config.CreateMap <DomainProperty, PropertyViewEntity>().ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.NameIndex.Name))
            .ForMember(dest => dest.TypeName, opt => opt.MapFrom(src => src.TypeNameIndex.Name))
            .ForMember(dest => dest.PropertyValue, opt => opt.MapFrom(src => src.Value.PropertyString))
            .ForMember(dest => dest.IsErrored, opt => opt.Ignore())
            .ForMember(dest => dest.IsSelected, opt => opt.Ignore());

            #endregion Properties

            #region Objects

            config.CreateMap <DomainMipMap, MipMapViewEntity>().ForMember(dest => dest.IsEnabled, opt => opt.ResolveUsing(src => src.ImageData != null))
            .ForMember(dest => dest.IsChecked, opt => opt.Ignore())
            .ForMember(dest => dest.Level, opt => opt.Ignore());

            config.CreateMap <DomainExportedObject, ExportedObjectViewEntity>().ForMember(dest => dest.IsChecked, opt => opt.Ignore())
            .ForMember(dest => dest.IsSelected, opt => opt.Ignore())
            .PreserveReferences();

            #endregion Objects

            #region DTOs

            config.CreateMap <DomainUpkFile, FileViewEntity>().ForMember(dest => dest.GameVersion, opt => opt.ResolveUsing(src => src.GetMaxVersion()?.Version))
            .ForMember(dest => dest.ExportTypes, opt => opt.ResolveUsing(src => src.GetBestExports()?.Select(e => e.Name) ?? new List <string>()))
            .ForMember(dest => dest.IsChecked, opt => opt.Ignore())
            .ForMember(dest => dest.IsSelected, opt => opt.Ignore())
            .ForMember(dest => dest.IsErrored, opt => opt.Ignore())
            .ForMember(dest => dest.ContainsTargetObject, opt => opt.Ignore());

            #endregion DTOs
        }
Exemple #29
0
 public static IMapperConfigurationExpression MappingBuilder(IMapperConfigurationExpression builder)
 {
     builder.CreateMap <User, UserView>();
     return(builder);
 }
        protected override void Initialize(IMapperConfigurationExpression mapperConfiguration)
        {
            NullGuard.NotNull(mapperConfiguration, nameof(mapperConfiguration));

            mapperConfiguration.CreateMap <IAccounting, AccountingIdentificationViewModel>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Number))
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <IAccounting, AccountingViewModel>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Number))
            .ForMember(dest => dest.LetterHead, opt => opt.MapFrom(src => _commonViewModelConverter.Convert <ILetterHead, LetterHeadViewModel>(src.LetterHead)))
            .ForMember(dest => dest.Accounts, opt => opt.MapFrom(src => src.AccountCollection))
            .ForMember(dest => dest.BudgetAccounts, opt => opt.MapFrom(src => src.BudgetAccountCollection))
            .ForMember(dest => dest.ContactAccounts, opt => opt.MapFrom(src => src.ContactAccountCollection))
            .ForMember(dest => dest.PostingLines, opt => opt.MapFrom(src => src.GetPostingLinesAsync(src.StatusDate).GetAwaiter().GetResult().Between(DateTime.MinValue, src.StatusDate).Top(25)))
            .ForMember(dest => dest.PostingJournalKey, opt => opt.Ignore())
            .ForMember(dest => dest.PostingJournal, opt => opt.Ignore())
            .ForMember(dest => dest.PostingJournalResultKey, opt => opt.Ignore())
            .ForMember(dest => dest.PostingJournalResult, opt => opt.Ignore())
            .ForMember(dest => dest.LetterHeads, opt => opt.MapFrom(src => new List <LetterHeadViewModel>(0)))
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <AccountingViewModel, CreateAccountingCommand>()
            .ForMember(dest => dest.LetterHeadNumber, opt => opt.MapFrom(src => src.LetterHead.Number));

            mapperConfiguration.CreateMap <AccountingViewModel, UpdateAccountingCommand>()
            .ForMember(dest => dest.LetterHeadNumber, opt => opt.MapFrom(src => src.LetterHead.Number));

            mapperConfiguration.CreateMap <IAccountBase, AccountIdentificationViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <IAccount, AccountIdentificationViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <IAccount, AccountCoreDataViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <IAccount, AccountViewModel>()
            .ForMember(dest => dest.CreditInfos, opt => opt.MapFrom(src => src.CreditInfoCollection))
            .ForMember(dest => dest.PostingLines, opt => opt.MapFrom(src => src.PostingLineCollection.Between(DateTime.MinValue, src.StatusDate).Top(25)))
            .ForMember(dest => dest.AccountGroups, opt => opt.MapFrom(src => new List <AccountGroupViewModel>(0)))
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <AccountViewModel, CreateAccountCommand>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Accounting.AccountingNumber))
            .ForMember(dest => dest.AccountGroupNumber, opt => opt.MapFrom(src => src.AccountGroup.Number))
            .ForMember(dest => dest.CreditInfoCollection, opt =>
            {
                opt.Condition(src => src.CreditInfos != null);
                opt.ConvertUsing(_creditInfoDictionaryViewModelToCreditInfoCommandCollectionValueConverter, src => src.CreditInfos);
            });

            mapperConfiguration.CreateMap <AccountViewModel, UpdateAccountCommand>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Accounting.AccountingNumber))
            .ForMember(dest => dest.AccountGroupNumber, opt => opt.MapFrom(src => src.AccountGroup.Number))
            .ForMember(dest => dest.CreditInfoCollection, opt =>
            {
                opt.Condition(src => src.CreditInfos != null);
                opt.ConvertUsing(_creditInfoDictionaryViewModelToCreditInfoCommandCollectionValueConverter, src => src.CreditInfos);
            });

            mapperConfiguration.CreateMap <AccountViewModel, DeleteAccountCommand>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Accounting.AccountingNumber));

            mapperConfiguration.CreateMap <IAccountCollection, AccountCollectionViewModel>()
            .ForMember(dest => dest.Items, opt => opt.MapFrom(src => src.OrderBy(account => account.AccountNumber).ToArray()));

            mapperConfiguration.CreateMap <IAccountCollection, AccountDictionaryViewModel>()
            .ConvertUsing(_accountCollectionToAccountDictionaryViewModelTypeConverter);

            mapperConfiguration.CreateMap <ICreditInfo, CreditInfoViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <CreditInfoViewModel, CreditInfoCommand>();

            mapperConfiguration.CreateMap <ICreditInfoValues, CreditInfoValuesViewModel>();

            mapperConfiguration.CreateMap <IAccountCollectionValues, AccountCollectionValuesViewModel>();

            mapperConfiguration.CreateMap <ICreditInfoCollection, CreditInfoCollectionViewModel>()
            .ForMember(dest => dest.Items, opt => opt.MapFrom(src => src.OrderByDescending(creditInfo => creditInfo.Year * 100 + creditInfo.Month).ToArray()));

            mapperConfiguration.CreateMap <ICreditInfoCollection, CreditInfoDictionaryViewModel>()
            .ConvertUsing(_creditInfoCollectionToCreditInfoDictionaryViewModelTypeConverter);

            mapperConfiguration.CreateMap <IBudgetAccount, AccountIdentificationViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <IBudgetAccount, AccountCoreDataViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <IBudgetAccount, BudgetAccountViewModel>()
            .ForMember(dest => dest.BudgetInfos, opt => opt.MapFrom(src => src.BudgetInfoCollection))
            .ForMember(dest => dest.PostingLines, opt => opt.MapFrom(src => src.PostingLineCollection.Between(src.StatusDate.Year > DateTime.MinValue.Year ? new DateTime(src.StatusDate.Year - 1, 1, 1) : DateTime.MinValue, src.StatusDate).Top(25)))
            .ForMember(dest => dest.BudgetAccountGroups, opt => opt.MapFrom(src => new List <BudgetAccountGroupViewModel>(0)))
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <BudgetAccountViewModel, CreateBudgetAccountCommand>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Accounting.AccountingNumber))
            .ForMember(dest => dest.BudgetAccountGroupNumber, opt => opt.MapFrom(src => src.BudgetAccountGroup.Number))
            .ForMember(dest => dest.BudgetInfoCollection, opt =>
            {
                opt.Condition(src => src.BudgetInfos != null);
                opt.ConvertUsing(_budgetInfoDictionaryViewModelToBudgetInfoCommandCollectionValueConverter, src => src.BudgetInfos);
            });

            mapperConfiguration.CreateMap <BudgetAccountViewModel, UpdateBudgetAccountCommand>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Accounting.AccountingNumber))
            .ForMember(dest => dest.BudgetAccountGroupNumber, opt => opt.MapFrom(src => src.BudgetAccountGroup.Number))
            .ForMember(dest => dest.BudgetInfoCollection, opt =>
            {
                opt.Condition(src => src.BudgetInfos != null);
                opt.ConvertUsing(_budgetInfoDictionaryViewModelToBudgetInfoCommandCollectionValueConverter, src => src.BudgetInfos);
            });

            mapperConfiguration.CreateMap <BudgetAccountViewModel, DeleteBudgetAccountCommand>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Accounting.AccountingNumber));

            mapperConfiguration.CreateMap <IBudgetAccountCollection, BudgetAccountCollectionViewModel>()
            .ForMember(dest => dest.Items, opt => opt.MapFrom(src => src.OrderBy(budgetAccount => budgetAccount.AccountNumber).ToArray()));

            mapperConfiguration.CreateMap <IBudgetAccountCollection, BudgetAccountDictionaryViewModel>()
            .ConvertUsing(_budgetAccountCollectionToBudgetAccountDictionaryViewModelTypeConverter);

            mapperConfiguration.CreateMap <IBudgetInfo, BudgetInfoViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <BudgetInfoViewModel, BudgetInfoCommand>();

            mapperConfiguration.CreateMap <IBudgetInfoValues, BudgetInfoValuesViewModel>();

            mapperConfiguration.CreateMap <IBudgetInfoCollection, BudgetInfoCollectionViewModel>()
            .ForMember(dest => dest.Items, opt => opt.MapFrom(src => src.OrderByDescending(budgetInfo => budgetInfo.Year * 100 + budgetInfo.Month).ToArray()));

            mapperConfiguration.CreateMap <IBudgetInfoCollection, BudgetInfoDictionaryViewModel>()
            .ConvertUsing(_budgetInfoCollectionToBudgetInfoDictionaryViewModelTypeConverter);

            mapperConfiguration.CreateMap <IContactAccount, AccountIdentificationViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <IContactAccount, AccountCoreDataViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <IContactAccount, ContactAccountViewModel>()
            .ForMember(dest => dest.BalanceInfos, opt => opt.MapFrom(src => src.ContactInfoCollection))
            .ForMember(dest => dest.PostingLines, opt => opt.MapFrom(src => src.PostingLineCollection.Between(DateTime.MinValue, src.StatusDate).Top(25)))
            .ForMember(dest => dest.PaymentTerms, opt => opt.MapFrom(src => new List <PaymentTermViewModel>(0)))
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <ContactAccountViewModel, CreateContactAccountCommand>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Accounting.AccountingNumber))
            .ForMember(dest => dest.PaymentTermNumber, opt => opt.MapFrom(src => src.PaymentTerm.Number));

            mapperConfiguration.CreateMap <ContactAccountViewModel, UpdateContactAccountCommand>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Accounting.AccountingNumber))
            .ForMember(dest => dest.PaymentTermNumber, opt => opt.MapFrom(src => src.PaymentTerm.Number));

            mapperConfiguration.CreateMap <ContactAccountViewModel, DeleteContactAccountCommand>()
            .ForMember(dest => dest.AccountingNumber, opt => opt.MapFrom(src => src.Accounting.AccountingNumber));

            mapperConfiguration.CreateMap <IContactAccountCollection, ContactAccountCollectionViewModel>()
            .ForMember(dest => dest.Items, opt => opt.MapFrom(src => src.OrderBy(contactAccount => contactAccount.AccountName).ToArray()));

            mapperConfiguration.CreateMap <IContactInfo, BalanceInfoViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <IContactInfoValues, BalanceInfoValuesViewModel>();

            mapperConfiguration.CreateMap <IContactAccountCollectionValues, ContactAccountCollectionValuesViewModel>();

            mapperConfiguration.CreateMap <IContactInfoCollection, BalanceInfoCollectionViewModel>()
            .ForMember(dest => dest.Items, opt => opt.MapFrom(src => src.OrderByDescending(contactInfo => contactInfo.Year * 100 + contactInfo.Month).ToArray()));

            mapperConfiguration.CreateMap <IContactInfoCollection, BalanceInfoDictionaryViewModel>()
            .ConvertUsing(_contactInfoCollectionTBalanceInfoCollectionViewModelTypeConverter);

            mapperConfiguration.CreateMap <IPostingLine, PostingLineViewModel>()
            .ForMember(dest => dest.Debit, opt => opt.MapFrom(src => src.Debit != 0M ? src.Debit : (decimal?)null))
            .ForMember(dest => dest.Credit, opt => opt.MapFrom(src => src.Credit != 0M ? src.Credit : (decimal?)null))
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <IPostingLineCollection, PostingLineCollectionViewModel>()
            .ConvertUsing(_postingLineCollectionToPostingLineCollectionViewModelTypeConverter);

            mapperConfiguration.CreateMap <IPostingWarning, PostingWarningViewModel>()
            .ForMember(dest => dest.Identifier, opt => opt.MapFrom(src => Guid.NewGuid()));

            mapperConfiguration.CreateMap <IPostingWarningCollection, PostingWarningCollectionViewModel>()
            .ConvertUsing(_postingWarningCollectionToPostingWarningCollectionViewModelTypeConverter);

            mapperConfiguration.CreateMap <IPostingJournalResult, ApplyPostingJournalResultViewModel>()
            .ForMember(dest => dest.PostingLines, opt => opt.MapFrom(src => src.PostingLineCollection))
            .ForMember(dest => dest.PostingWarnings, opt => opt.MapFrom(src => src.PostingWarningCollection));

            mapperConfiguration.CreateMap <ApplyPostingLineViewModel, ApplyPostingLineCommand>()
            .ForMember(dest => dest.PostingDate, opt => opt.MapFrom(src => src.PostingDate.LocalDateTime.Date))
            .ForMember(dest => dest.Reference, opt =>
            {
                opt.Condition(src => string.IsNullOrWhiteSpace(src.Reference) == false);
                opt.MapFrom(src => string.IsNullOrWhiteSpace(src.Reference) ? null : src.Reference);
            })
            .ForMember(dest => dest.BudgetAccountNumber, opt =>
            {
                opt.Condition(src => string.IsNullOrWhiteSpace(src.BudgetAccountNumber) == false);
                opt.MapFrom(src => string.IsNullOrWhiteSpace(src.BudgetAccountNumber) ? null : src.BudgetAccountNumber);
            })
            .ForMember(dest => dest.ContactAccountNumber, opt =>
            {
                opt.Condition(src => string.IsNullOrWhiteSpace(src.ContactAccountNumber) == false);
                opt.MapFrom(src => string.IsNullOrWhiteSpace(src.ContactAccountNumber) ? null : src.ContactAccountNumber);
            })
            .ForMember(dest => dest.SortOrder, opt => opt.MapFrom(src => src.SortOrder ?? 0));

            mapperConfiguration.CreateMap <ApplyPostingJournalViewModel, ApplyPostingJournalCommand>()
            .ForMember(dest => dest.PostingLineCollection, opt => opt.ConvertUsing(_applyPostingLineCollectionViewModelToApplyPostingLineCommandCollectionValueConverter, src => src.ApplyPostingLines));

            mapperConfiguration.CreateMap <IAccountGroup, AccountGroupViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <AccountGroupViewModel, CreateAccountGroupCommand>();
            mapperConfiguration.CreateMap <AccountGroupViewModel, UpdateAccountGroupCommand>();
            mapperConfiguration.CreateMap <AccountGroupViewModel, DeleteAccountGroupCommand>();

            mapperConfiguration.CreateMap <IBudgetAccountGroup, BudgetAccountGroupViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <BudgetAccountGroupViewModel, CreateBudgetAccountGroupCommand>();
            mapperConfiguration.CreateMap <BudgetAccountGroupViewModel, UpdateBudgetAccountGroupCommand>();
            mapperConfiguration.CreateMap <BudgetAccountGroupViewModel, DeleteBudgetAccountGroupCommand>();

            mapperConfiguration.CreateMap <Domain.Interfaces.Accounting.Enums.BalanceBelowZeroType, BalanceBelowZeroType>();
            mapperConfiguration.CreateMap <BalanceBelowZeroType, Domain.Interfaces.Accounting.Enums.BalanceBelowZeroType>();

            mapperConfiguration.CreateMap <Domain.Interfaces.Accounting.Enums.AccountGroupType, AccountGroupType>();
            mapperConfiguration.CreateMap <AccountGroupType, Domain.Interfaces.Accounting.Enums.AccountGroupType>();

            mapperConfiguration.CreateMap <Domain.Interfaces.Accounting.Enums.PostingWarningReason, PostingWarningReason>();

            mapperConfiguration.CreateMap <IPaymentTerm, PaymentTermViewModel>()
            .ForMember(dest => dest.EditMode, opt => opt.MapFrom(src => EditMode.None));

            mapperConfiguration.CreateMap <PaymentTermViewModel, CreatePaymentTermCommand>();
            mapperConfiguration.CreateMap <PaymentTermViewModel, UpdatePaymentTermCommand>();
            mapperConfiguration.CreateMap <PaymentTermViewModel, DeletePaymentTermCommand>();
        }
 public void Bind(IMapperConfigurationExpression cfg)
 {
     cfg.CreateMap <RoleMenuAddModel, RoleMenuEntity>();
     cfg.CreateMap <RoleMenuEntity, RoleMenuUpdateModel>();
 }
        public static void Register(IMapperConfigurationExpression cfg)
        {
            //aphorism
            cfg.CreateMap<Aphorism, VMAphorism>();
            cfg.CreateMap<VMAphorism, Aphorism>();

            //article
            cfg.CreateMap<Article, VMArticle>();
            cfg.CreateMap<VMArticle, Article>();

            //author aphorism
            cfg.CreateMap<AuthorAphorism, VMAuthorAphorism>();
            cfg.CreateMap<VMAuthorAphorism, AuthorAphorism>();

            //game
            cfg.CreateMap<Game, VMGame>();
            cfg.CreateMap<VMGame, Game>();

            //humor
            cfg.CreateMap<Humor, VMHumor>();
            cfg.CreateMap<VMHumor, Humor>();

            //material category
            cfg.CreateMap<MaterialCategory, VMMaterialCategory>();
            cfg.CreateMap<VMMaterialCategory, MaterialCategory>()
                .ForMember(d => d.ParentId, d => d.MapFrom(s => (string)s.ParentId));

            //news
            cfg.CreateMap<News, VMNews>();
            cfg.CreateMap<VMNews, News>();

            //site test
            cfg.CreateMap<SiteTest, VMSiteTest>();
            cfg.CreateMap<VMSiteTest, SiteTest>();

            //site test answer
            cfg.CreateMap<SiteTestAnswer, VMSiteTestAnswer>();
            cfg.CreateMap<VMSiteTestAnswer, SiteTestAnswer>();

            //site test question
            cfg.CreateMap<SiteTestQuestion, VMSiteTestQuestion>();
            cfg.CreateMap<VMSiteTestQuestion, SiteTestQuestion>();

            //site test setting
            cfg.CreateMap<SiteTestSetting, VMSiteTestSetting>();
            cfg.CreateMap<VMSiteTestSetting, SiteTestSetting>();

            //site test subject
            cfg.CreateMap<SiteTestSubject, VMSiteTestSubject>();
            cfg.CreateMap<VMSiteTestSubject, SiteTestSubject>();
        }
Exemple #33
0
 public override void CreateDalMapper(IMapperConfigurationExpression cfg)
 {
     cfg.CreateMap <ArticleSchedule, ArticleScheduleDAL>(MemberList.Destination)
     .ForMember(data => data.Article, opt => opt.Ignore())
     ;
 }
Exemple #34
0
 public static void UserProfileMap(IMapperConfigurationExpression cfg)
 {
     cfg.CreateMap <UserProfile, UserProfileModel>();
     cfg.CreateMap <UserProfileModel, UserProfile>();
 }
Exemple #35
0
        private static void Config(IMapperConfigurationExpression expression)
        {
            #region CompanyProduct => CompanyProductViewModel

            expression.CreateMap <CompanyProduct, CompanyProductViewModel>()
            .ForMember(productVm => productVm.Title,
                       configExpr => configExpr.MapFrom(model => model.Title))
            .ForMember(productVm => productVm.Description,
                       configExpr => configExpr.MapFrom(product => product.Description))
            .ForMember(productVm => productVm.ImagePath,
                       configExpr => configExpr.MapFrom(product => product.ImagePath));

            #endregion

            #region RssFeed => RssFeedViewModel

            expression.CreateMap <NewsFeed, RssFeedViewModel>()
            .ForMember(rssFeedVm => rssFeedVm.FeedId,
                       configExpr => configExpr.MapFrom(newsFeed => newsFeed.Id))
            .ForMember(rssFeedVm => rssFeedVm.Title,
                       configExpr => configExpr.MapFrom(newsFeed => newsFeed.Title))
            .ForMember(rssFeedVm => rssFeedVm.Details,
                       configExpr => configExpr.MapFrom(newsFeed => newsFeed.Details))
            .ForMember(rssFeedVm => rssFeedVm.RelatedLink,
                       configExpr => configExpr.MapFrom(newsFeed => newsFeed.RelatedLink))
            .ForMember(rssFeedVm => rssFeedVm.HasImageData,
                       configExpr => configExpr.MapFrom(newsFeed => newsFeed.ImageData != null))
            .ForMember(rssFeedVm => rssFeedVm.NewsDate,
                       configExpr => configExpr.MapFrom(newsFeed => newsFeed.NewsDate))
            .ForMember(rssFeedVm => rssFeedVm.ImageMimeType,
                       configExpr => configExpr.MapFrom(newsFeed => newsFeed.ImageMimeType));

            #endregion

            #region RssFeedViewModel => RssFeed

            expression.CreateMap <RssFeedViewModel, NewsFeed>()
            .ForMember(newsFeed => newsFeed.Id,
                       configExpr => configExpr.MapFrom(rssFeedVm => rssFeedVm.FeedId))
            .ForMember(newsFeed => newsFeed.Title,
                       configExpr => configExpr.MapFrom(rssFeedVm => rssFeedVm.Title))
            .ForMember(newsFeed => newsFeed.Details,
                       configExpr => configExpr.MapFrom(rssFeedVm => rssFeedVm.Details))
            .ForMember(newsFeed => newsFeed.RelatedLink,
                       configExpr => configExpr.MapFrom(rssFeedVm => rssFeedVm.RelatedLink))
            .ForMember(newsFeed => newsFeed.NewsDate,
                       configExpr => configExpr.MapFrom(rssFeedVm => rssFeedVm.NewsDate))
            .ForMember(newsFeed => newsFeed.ImageMimeType,
                       configExpr => configExpr.MapFrom(rssFeedVm => rssFeedVm.ImageMimeType))
            .ForMember(newsFeed => newsFeed.ImageData,
                       configExpr => configExpr.MapFrom(rssFeedVm => new byte[0]));

            #endregion

            #region SlideItem => SlideItemViewModel

            expression.CreateMap <SlideItem, SlideItemViewModel>()
            .ForMember(slideItemVm => slideItemVm.Title,
                       configExpr => configExpr.MapFrom(model => model.Title))
            .ForMember(slideItemVm => slideItemVm.ImagePath,
                       configExpr => configExpr.MapFrom(product => product.ImagePath));

            #endregion

            #region JobVacancy => JobVacancyViewModel

            expression.CreateMap <JobVacancy, JobVacancyViewModel>()
            .ForMember(jobVm => jobVm.Id,
                       configExpr => configExpr.MapFrom(vacancy => vacancy.JobId))
            .ForMember(jobVm => jobVm.Title,
                       configExpr => configExpr.MapFrom(vacancy => vacancy.JobTitle))
            .ForMember(jobVm => jobVm.City,
                       configExpr => configExpr.MapFrom(vacancy => vacancy.LocationCity))
            .ForMember(jobVm => jobVm.SalaryLevel,
                       configExpr => configExpr.MapFrom(vacancy => vacancy.SalaryLevel))
            .ForMember(jobVm => jobVm.WorkExperience,
                       configExpr => configExpr.MapFrom(vacancy => ConvertEmploymentType(vacancy)))
            .ForMember(jobVm => jobVm.EmploymentType,
                       configExpr => configExpr.MapFrom(vacancy => ConvertJobVacancy(vacancy)))
            .ForMember(jobVm => jobVm.IsActive,
                       configExpr => configExpr.MapFrom(vacancy => vacancy.IsActive))
            .ForMember(jobVm => jobVm.Responsibilities,
                       configExpr =>
                       configExpr.MapFrom(
                           vacancy =>
                           vacancy.JobVacancyMainResponsibilities.Select(
                               responsibility => responsibility.ResponsibilityItem).ToList()))
            .ForMember(jobVm => jobVm.Misc,
                       configExpr =>
                       configExpr.MapFrom(vacancy => vacancy.JobVacancyMiscs.Select(misc => misc.MiscItem).ToList()))
            .ForMember(jobVm => jobVm.Requirements,
                       configExpr =>
                       configExpr.MapFrom(
                           vacancy =>
                           vacancy.JobVacancyRequirements.Select(requirement => requirement.RequirementItem).ToList()))
            .ForMember(jobVm => jobVm.RestRequirements,
                       configExpr =>
                       configExpr.MapFrom(
                           vacancy =>
                           vacancy.JobVacancyRestRequirements.Select(requirement => requirement.MiscRequirement).ToList()))
            .ForMember(jobVm => jobVm.WorkingConditions,
                       configExpr =>
                       configExpr.MapFrom(
                           vacancy =>
                           vacancy.JobVacancyWorkingConditions.Select(condition => condition.ConditionItem).ToList()));

            #endregion

            #region JobVacancyViewModel => JobVacancy

            expression.CreateMap <JobVacancyViewModel, JobVacancy>()
            .ForMember(vacancy => vacancy.JobId,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.Id))
            .ForMember(vacancy => vacancy.JobTitle,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.Title))
            .ForMember(vacancy => vacancy.LocationCity,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.City))
            .ForMember(vacancy => vacancy.SalaryLevel,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.SalaryLevel))
            .ForMember(vacancy => vacancy.WorkExperience,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.WorkExperience.ToString()))
            .ForMember(vacancy => vacancy.EmploymentType,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.EmploymentType.ToString()))
            .ForMember(vacancy => vacancy.IsActive,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.IsActive))
            .ForMember(vacancy => vacancy.JobVacancyMainResponsibilities,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.ToResponsibilities()))
            .ForMember(vacancy => vacancy.JobVacancyMiscs,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.ToMisc()))
            .ForMember(vacancy => vacancy.JobVacancyRequirements,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.ToRequirements()))
            .ForMember(vacancy => vacancy.JobVacancyRestRequirements,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.ToRestRequirements()))
            .ForMember(vacancy => vacancy.JobVacancyWorkingConditions,
                       configExpr => configExpr.MapFrom(vacancyVm => vacancyVm.ToWorkingConditions()));

            #endregion
        }
Exemple #36
0
 public void CreateMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap <IEnumerable <OrderViewModel>, OrdersManagerViewModel>()
     .ForMember(dest => dest.Orders, s => s.MapFrom(src => src));
 }
 public static void Map(IMapperConfigurationExpression cfg) =>
     cfg.CreateMap<Domain.PermissionScope, PermissionScope>();
Exemple #38
0
        //private static void ArizaLogMap(IMapperConfigurationExpression cfg)
        //{
        //    cfg.CreateMap<ArizaLOG, ArizaLogViewModel>().ReverseMap();
        //}


        private static void ArizaKayitMap(IMapperConfigurationExpression cfg)
        {
            cfg.CreateMap <ArızaKayıt, ArizaViewModel>()
            .ForMember(dest => dest.ArizaId, opt => opt.MapFrom(x => x.Id))
            .ReverseMap();
        }
 public void CreateMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap<Source, TestConfig>().ForMember(dest => dest.Number, opt => opt.MapFrom(src => src.Nr));
     configuration.CreateMap<TestConfig, Source>().ForMember(dest => dest.Nr, opt => opt.MapFrom(src => src.Number)); ;
 }
 public void CreateMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap <HouseholdManager.Models.Household, HouseholdViewModel>();
 }
 public void CreateMappings(IMapperConfigurationExpression configuration)
 {
     configuration.CreateMap <Garage, GarageAdministrationViewModel>()
     .ForMember(u => u.Clients, opt => opt.MapFrom(u => u.Clients));
 }
Exemple #42
0
        public static IMapperConfigurationExpression AddVegaDalMaps(this IMapperConfigurationExpression configuration)
        {
            configuration.CreateMap <UserAccountDataModel, UserAccountModel>();

            return(configuration);
        }
 public void CreateMappings(IMapperConfigurationExpression config)
 {
     config.CreateMap <CityViewModel, City>()
     .ConstructUsing(x => new City(x.Name, x.CountryId));
 }
    public void RegisterMappings(IMapperConfigurationExpression config) {

      #region Settings

      config.CreateMap<DomainSettings, SettingsDialogViewEntity>().ReverseMap();

      config.CreateMap<DomainSettings, SettingsWindowViewEntity>().ForMember(dest => dest.AreSettingsChanged, opt => opt.Ignore())
                                                                  .ForMember(dest => dest.MainWindowState,    opt => opt.ResolveUsing(src => src.Maximized ? WindowState.Maximized : WindowState.Normal));

      config.CreateMap<SettingsWindowViewEntity, DomainSettings>().ForMember(dest => dest.Maximized,  opt => opt.ResolveUsing(src => src.MainWindowState == WindowState.Maximized))
                                                                  .ForMember(dest => dest.PathToGame, opt => opt.Ignore())
                                                                  .ForMember(dest => dest.ExportPath, opt => opt.Ignore());

      #endregion Settings

      #region Messages

      config.CreateMap<DomainLoadProgress, LoadProgressMessage>().ForMember(dest => dest.CanAsync,         opt => opt.Ignore())
                                                                 .ForMember(dest => dest.IsLocalMode, opt => opt.Ignore());

      #endregion Messages

      #region Header

      config.CreateMap<DomainHeader, HeaderViewEntity>().ForMember(dest => dest.Group, opt => opt.MapFrom(src => src.Group.String))
                                                        .ForMember(dest => dest.Guid,  opt => opt.ResolveUsing(src => new Guid(src.Guid)));

      #endregion Header

      #region Tables

      config.CreateMap<DomainExportTableEntry, ExportTableEntryViewEntity>().ForMember(dest => dest.Guid,          opt => opt.ResolveUsing(src => new Guid(src.Guid)))
                                                                            .ForMember(dest => dest.ArchetypeName, opt => opt.MapFrom(src => src.ArchetypeReferenceNameIndex.Name))
                                                                            .ForMember(dest => dest.OwnerName,     opt => opt.MapFrom(src => src.OwnerReferenceNameIndex.Name))
                                                                            .ForMember(dest => dest.TypeName,      opt => opt.MapFrom(src => src.TypeReferenceNameIndex.Name))
                                                                            .ForMember(dest => dest.Name,          opt => opt.MapFrom(src => src.NameTableIndex.Name))
                                                                            .ForMember(dest => dest.IsSelected,    opt => opt.Ignore())
                                                                            .ForMember(dest => dest.IsErrored,     opt => opt.Ignore());

      config.CreateMap<DomainExportTableEntry, ObjectTreeViewEntity>().ForMember(dest => dest.Name,       opt => opt.MapFrom(src => src.NameTableIndex.Name))
                                                                      .ForMember(dest => dest.IsExport,   opt => opt.UseValue(true))
                                                                      .ForMember(dest => dest.IsImport,   opt => opt.UseValue(false))
                                                                      .ForMember(dest => dest.IsExpanded, opt => opt.Ignore())
                                                                      .ForMember(dest => dest.IsSelected, opt => opt.Ignore())
                                                                      .ForMember(dest => dest.Parent,     opt => opt.Ignore())
                                                                      .ForMember(dest => dest.Children,   opt => opt.UseValue(new ObservableCollection<ObjectTreeViewEntity>()));

      config.CreateMap<DomainImportTableEntry, ImportTableEntryViewEntity>().ForMember(dest => dest.PackageName,        opt => opt.MapFrom(src => src.PackageNameIndex.Name))
                                                                            .ForMember(dest => dest.TypeName,           opt => opt.MapFrom(src => src.TypeNameIndex.Name))
                                                                            .ForMember(dest => dest.Name,               opt => opt.MapFrom(src => src.NameTableIndex.Name))
                                                                            .ForMember(dest => dest.OwnerReferenceName, opt => opt.MapFrom(src => src.OwnerReferenceNameIndex.Name))
                                                                            .ForMember(dest => dest.IsErrored,          opt => opt.Ignore())
                                                                            .ForMember(dest => dest.IsSelected,         opt => opt.Ignore());

      config.CreateMap<DomainImportTableEntry, ObjectTreeViewEntity>().ForMember(dest => dest.Name,       opt => opt.MapFrom(src => src.NameTableIndex.Name))
                                                                      .ForMember(dest => dest.IsExport,   opt => opt.UseValue(false))
                                                                      .ForMember(dest => dest.IsImport,   opt => opt.UseValue(true))
                                                                      .ForMember(dest => dest.IsExpanded, opt => opt.Ignore())
                                                                      .ForMember(dest => dest.IsSelected, opt => opt.Ignore())
                                                                      .ForMember(dest => dest.Parent,     opt => opt.Ignore())
                                                                      .ForMember(dest => dest.Children,   opt => opt.UseValue(new ObservableCollection<ObjectTreeViewEntity>()));

      config.CreateMap<DomainNameTableEntry, NameTableEntryViewEntity>().ForMember(dest => dest.Name,       opt => opt.MapFrom(src => src.Name.String))
                                                                        .ForMember(dest => dest.IsErrored,  opt => opt.Ignore())
                                                                        .ForMember(dest => dest.IsSelected, opt => opt.Ignore());

      config.CreateMap<DomainGenerationTableEntry, GenerationsTableEntryViewEntity>().ForMember(dest => dest.IsErrored,  opt => opt.Ignore())
                                                                                     .ForMember(dest => dest.IsSelected, opt => opt.Ignore());

      config.CreateMap<DomainCompressedChunk, CompressionTableEntryViewEntity>().ForMember(dest => dest.BlockSize,         opt => opt.MapFrom(src => src.Header.BlockSize))
                                                                                .ForMember(dest => dest.CompressionBlocks, opt => opt.MapFrom(src => src.Header.Blocks))
                                                                                .ForMember(dest => dest.IsErrored,         opt => opt.Ignore())
                                                                                .ForMember(dest => dest.IsSelected,        opt => opt.Ignore());

      config.CreateMap<DomainCompressedChunkBlock, CompressionBlockViewEntity>().ForMember(dest => dest.IsSelected, opt => opt.Ignore());

      #endregion Tables

      #region Properties

      config.CreateMap<DomainProperty, PropertyViewEntity>().ForMember(dest => dest.Name,          opt => opt.MapFrom(src => src.NameIndex.Name))
                                                            .ForMember(dest => dest.TypeName,      opt => opt.MapFrom(src => src.TypeNameIndex.Name))
                                                            .ForMember(dest => dest.PropertyValue, opt => opt.MapFrom(src => src.Value.PropertyString))
                                                            .ForMember(dest => dest.IsErrored,     opt => opt.Ignore())
                                                            .ForMember(dest => dest.IsSelected,    opt => opt.Ignore());

      #endregion Properties

      #region Objects

      config.CreateMap<DomainMipMap, MipMapViewEntity>().ForMember(dest => dest.IsEnabled, opt => opt.ResolveUsing(src => src.ImageData != null))
                                                        .ForMember(dest => dest.IsChecked, opt => opt.Ignore())
                                                        .ForMember(dest => dest.Level,     opt => opt.Ignore());

      config.CreateMap<DomainExportedObject, ExportedObjectViewEntity>().ForMember(dest => dest.IsChecked,  opt => opt.Ignore())
                                                                        .ForMember(dest => dest.IsSelected, opt => opt.Ignore())
                                                                        .PreserveReferences();

      #endregion Objects

      #region DTOs

      config.CreateMap<DomainUpkFile, FileViewEntity>().ForMember(dest => dest.GameVersion,          opt => opt.ResolveUsing(src => src.GetMaxVersion()))
                                                       .ForMember(dest => dest.ExportTypes,          opt => opt.ResolveUsing(src => src.GetBestExports()?.Select(e => e.Name) ?? new List<string>()))
                                                       .ForMember(dest => dest.IsChecked,            opt => opt.Ignore())
                                                       .ForMember(dest => dest.IsSelected,           opt => opt.Ignore())
                                                       .ForMember(dest => dest.IsErrored,            opt => opt.Ignore())
                                                       .ForMember(dest => dest.ContainsTargetObject, opt => opt.Ignore());

      #endregion DTOs

    }
 internal static void CreateMaps(IMapperConfigurationExpression cfg)
 {
     cfg.CreateMap<Domain.UserInstance, Models.UserInstanceModel>()
         .ForMember(d=>d.InstanceType,o=>o.MapFrom(s=>s.Type));
 }
Exemple #46
-6
        private void RegisterMaps(IMapperConfigurationExpression config)
        {
            config.CreateMap<Rma,RmaViewModel>()
                .ForMember(x => x.HardwareTypeName, m => m.MapFrom(x => x.HardwareType.Name));

            config.CreateMap<RmaViewModel,Rma>().ConvertUsing<RmaVmToEntity>();
        }