当前位置: 首页>>代码示例>>C#>>正文


C# IConfiguration.CreateMap方法代码示例

本文整理汇总了C#中IConfiguration.CreateMap方法的典型用法代码示例。如果您正苦于以下问题:C# IConfiguration.CreateMap方法的具体用法?C# IConfiguration.CreateMap怎么用?C# IConfiguration.CreateMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IConfiguration的用法示例。


在下文中一共展示了IConfiguration.CreateMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configure

        public void Configure(IConfiguration config)
        {
            config.CreateMap<HomeTrack.Transaction, Transaction>()
                .ForMember(x => x.Id, map => map.ResolveUsing(x => x.Id ?? TransactionId.From(x)));

            config.CreateMap<Transaction, HomeTrack.Transaction>();
        }
开发者ID:andy-uq,项目名称:HomeTrack,代码行数:7,代码来源:Transaction.cs

示例2: ConfigureMappings

        public override void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext)
        {
            //FROM IMacro TO EntityBasic
            config.CreateMap<IMacro, EntityBasic>()
                  .ForMember(entityBasic => entityBasic.Icon, expression => expression.UseValue("icon-settings-alt"))
                  .ForMember(dto => dto.ParentId, expression => expression.UseValue(-1))
                  .ForMember(dto => dto.Path, expression => expression.ResolveUsing(macro => "-1," + macro.Id));

            config.CreateMap<IMacro, IEnumerable<MacroParameter>>()
                    .ConvertUsing(macro => macro.Properties.Select(Mapper.Map<MacroParameter>).ToList());

            config.CreateMap<IMacroProperty, MacroParameter>()
                  .AfterMap((property, parameter) =>
                      {
                          //map the view and the config

                          var paramEditor = ParameterEditorResolver.Current.GetByAlias(property.EditorAlias);
                          if (paramEditor == null)
                          {
                              //we'll just map this to a text box
                              paramEditor = ParameterEditorResolver.Current.GetByAlias(Constants.PropertyEditors.TextboxAlias);
                              LogHelper.Warn<MacroModelMapper>("Could not resolve a parameter editor with alias " + property.EditorAlias + ", a textbox will be rendered in it's place");
                          }

                          parameter.View = paramEditor.ValueEditor.View;
                          //set the config
                          parameter.Configuration = paramEditor.Configuration;
                          
                      });

        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:31,代码来源:MacroModelMapper.cs

示例3: ConfigureMaps

        public static void ConfigureMaps(IConfiguration configStore)
        {
            configStore.CreateMap<SummaryRequest, SummaryViewModel>();
            configStore.CreateMap<LoginRequest, LoginViewModel>();
            configStore.CreateMap<RegisterRequest, RegisterViewModel>();
            configStore.CreateMap<NewThreadRequest, NewThreadViewModel>();
            configStore.CreateMap<NewThreadCommand, NewThreadRequest>();

            configStore.CreateMap<DiscussionThread, ViewThreadRequest>()
                .ForMember(x => x.IPAddress, opt => opt.Ignore())
                .ForMember(x => x.UserAccount, opt => opt.Ignore());

            configStore.CreateMap<DiscussionThread, ThreadSummaryViewModel>()
                .ForMember(x => x.TimeZoneOffset, opt => opt.Ignore());

            configStore.CreateMap<DiscussionThread, ViewThreadViewModel>()
                .ForMember(x => x.ReplyBody, opt => opt.Ignore())
                .ForMember(x => x.Replies, opt => opt.Ignore());

            configStore.CreateMap<LoginCommand, LoginRequest>()
                .ForMember(x => x.Password, opt => opt.Ignore());

            configStore.CreateMap<RegisterCommand, RegisterRequest>()
                .ForMember(x => x.Password, opt => opt.Ignore())
                .ForMember(x => x.ConfirmPassword, opt => opt.Ignore());
        }
开发者ID:marcusswope,项目名称:Hit-That-Line,代码行数:26,代码来源:AutoMapperRegistry.cs

示例4: Map

        public void Map(IConfiguration cfg)
        {
            cfg.CreateMap<PersonModel, Person>();
            cfg.CreateMap<Person, PersonModel>();

            cfg.CreateMap<BaptismModel, Baptism>();
            cfg.CreateMap<Baptism, BaptismModel>();
        }
开发者ID:Themendez,项目名称:ChurchManager,代码行数:8,代码来源:BaptismMapping.cs

示例5: CreateMap

        public void CreateMap(IConfiguration configuration)
        {
            configuration.CreateMap<Point, SimplePoint>();

            configuration.CreateMap<SimplePoint, Point>()
                .ConstructUsing(src => CreatePoint(src.X, src.Y))
                .ForAllMembers(d => d.Ignore());
        }
开发者ID:matanzg,项目名称:codecovered,代码行数:8,代码来源:SimplePointMapCreator.cs

示例6: Map

        public void Map(IConfiguration cfg)
        {
            cfg.CreateMap<PersonModel, Person>();
            cfg.CreateMap<Person, PersonModel>();

            cfg.CreateMap<ParishModel, Parish>();
            cfg.CreateMap<Parish, ParishModel>();
        }
开发者ID:Themendez,项目名称:ChurchManager,代码行数:8,代码来源:ParishMapping.cs

示例7: Configure

        public void Configure(IConfiguration config)
        {
            config.CreateMap<HomeTrack.Account, Models.Account>()
                .ForMember(x => x.AccountTypeName, map => map.MapFrom(x => x.Type));

            config.CreateMap<Models.Account, HomeTrack.Account>()
                .ForMember(x => x.Type, map => map.MapFrom(x => x.AccountTypeName));
        }
开发者ID:andy-uq,项目名称:HomeTrack,代码行数:8,代码来源:Account.cs

示例8: Configure

        public void Configure(IConfiguration config)
        {
            config.CreateMap<HomeTrack.ImportResult, ImportResult>();
            config.CreateMap<ImportResult, HomeTrack.ImportResult>();

            config.CreateMap<ImportedTransaction, HomeTrack.ImportedTransaction>();

            config.CreateMap<Transaction, ImportedTransaction>();
        }
开发者ID:andy-uq,项目名称:HomeTrack,代码行数:9,代码来源:ImportResult.cs

示例9: Create

        public void Create(IConfiguration configuration)
        {
            configuration.CreateMap<UserOrder, UserOrderListViewModel>()
                .ForMember(d => d.FirstName, o => o.MapFrom(s => s.User.FirstName))
                .ForMember(d => d.LastName, o => o.MapFrom(s => s.User.LastName));

            configuration.CreateMap<UserOrder, CreateEditUserOrderViewModel>()
                .ForMember(d => d.UserId, o => o.MapFrom(s => s.User.Id))
                .ForMember(d => d.Users, o => o.Ignore());
        }
开发者ID:Supermakaka,项目名称:GitTest,代码行数:10,代码来源:Mappings.cs

示例10: CreateMappings

        public void CreateMappings(IConfiguration configuration)
        {
            configuration
               .CreateMap<Administrator, AdministratorDetailViewModel>()
               .ForMember(viewModel => viewModel.IsCurrentAuthenticatedUser,
                          o => o.MapFrom(administrator => IsCurrentUser(administrator)))
               .IgnoreAllNonExisting();

            configuration
                .CreateMap<Charity, IEnumerable<AdministratorDetailViewModel>>()
                .ConvertUsing(ConvertToAdministratorDetailViewModels);
        }
开发者ID:Gwayaboy,项目名称:MVCSolutionSample,代码行数:12,代码来源:AdministratorDetailViewModel.cs

示例11: ConfigureMappings

 public void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext)
 {
     config.CreateMap<Section, Application>()
           .ForMember(x => x.alias, expression => expression.MapFrom(x => x.Alias))
           .ForMember(x => x.icon, expression => expression.MapFrom(x => x.Icon))
           .ForMember(x => x.name, expression => expression.MapFrom(x => x.Name))
           .ForMember(x => x.sortOrder, expression => expression.MapFrom(x => x.SortOrder)).ReverseMap();
     config.CreateMap<Application, Section>()
           .ForMember(x => x.Alias, expression => expression.MapFrom(x => x.alias))
           .ForMember(x => x.Icon, expression => expression.MapFrom(x => x.icon))
           .ForMember(x => x.Name, expression => expression.MapFrom(x => x.name))
           .ForMember(x => x.SortOrder, expression => expression.MapFrom(x => x.sortOrder));
 }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:13,代码来源:ApplicationRegistrar.cs

示例12: ConfigureMappings

        public override void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext)
        {
            config.CreateMap<IUser, UserDetail>()
                  .ForMember(detail => detail.UserId, opt => opt.MapFrom(user => GetIntId(user.Id)))
                  .ForMember(detail => detail.UserType, opt => opt.MapFrom(user => user.UserType.Alias))
                  .ForMember(detail => detail.Culture, opt => opt.MapFrom(user => ui.Culture(user)))
                  .ForMember(
                      detail => detail.EmailHash,
                      opt => opt.MapFrom(user => user.Email.ToLowerInvariant().Trim().ToMd5()));

            config.CreateMap<IProfile, UserBasic>()
                  .ForMember(detail => detail.UserId, opt => opt.MapFrom(profile => GetIntId(profile.Id)));
        } 
开发者ID:phaniarveti,项目名称:Experiments,代码行数:13,代码来源:UserModelMapper.cs

示例13: ConfigureMappings

        public override void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext)
        {
            config.CreateMap<IRelation, RelationRepresentation>()
                .ForMember(representation => representation.RelationTypeAlias, expression => expression.MapFrom(member => member.RelationType.Alias));

            config.CreateMap<RelationRepresentation, IRelation>()
                .ConstructUsing((RelationRepresentation source) => new Relation(source.ParentId, source.ChildId, ApplicationContext.Current.Services.RelationService.GetRelationTypeByAlias(source.RelationTypeAlias)))

                .ForMember(dto => dto.ParentId, expression => expression.Ignore())
                .ForMember(dto => dto.ChildId, expression => expression.Ignore())

                .ForMember(dest => dest.Id, expression => expression.Condition(representation => (representation.Id > 0)));
        }
开发者ID:robertjf,项目名称:UmbracoRestApi,代码行数:13,代码来源:RelationModelMapper.cs

示例14: Create

        public void Create(IConfiguration configuration)
        {
            configuration.CreateMap<Company, CompanyFormViewModel>();

            configuration.CreateMap<Company, CompanyListDatatableViewModel>();

            configuration.CreateMap<User, UserFormViewModel>()
                .ForMember(d => d.CompanyId, o => o.MapFrom(s => s.Company.Id))
                .IgnoreAllNonExisting();

            configuration.CreateMap<User, UserListDatatableViewModel>()
                .ForMember(d => d.CompanyName, o => o.MapFrom(s => s.Company.Name))
                .ForMember(d => d.CreateDate, o => o.ResolveUsing<DateToFormattedStringResolver>().FromMember(s => s.CreateDate)) 
                .ForMember(d => d.Role, o => o.ResolveUsing<UserRoleListToStringResolver>().FromMember(s => s));
        }
开发者ID:Supermakaka,项目名称:mvc6,代码行数:15,代码来源:Mappings.cs

示例15: CreateMappings

 public void CreateMappings(IConfiguration configuration)
 {
     configuration.CreateMap<Model.Question, QuestionModel>()
         .ForMember(m => m.Category, opt => opt.MapFrom(u => u.Category.Name))
         .ForMember(m => m.Choices, opt => opt.MapFrom(u => u.Choices))
         .ForMember(m => m.Files, opt => opt.MapFrom(u => u.Files));
 }
开发者ID:Ibrahim-Islam,项目名称:recruitment-management-system,代码行数:7,代码来源:QuestionModel.cs


注:本文中的IConfiguration.CreateMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。