• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMapperConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMapperConfiguration的典型用法代码示例。如果您正苦于以下问题:C# IMapperConfiguration类的具体用法?C# IMapperConfiguration怎么用?C# IMapperConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMapperConfiguration类属于命名空间,在下文中一共展示了IMapperConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Initialize

 public static void Initialize(IMapperConfiguration mapperConfig)
 {
     mapperConfig
         .CreateMap<GuessThePicture.DataAccessContracts.Dto.PictureDto, GuessThePicture.Domain.Entities.Picture>()
         .ForMember(i => i.Style, x => x.ResolveUsing(t => t.Style.Name))
         .ForMember(i => i.Campaigns, x => x.Ignore());
 }
开发者ID:ReaderOfDream,项目名称:GuessThePicture,代码行数:7,代码来源:AutomapperConfig.cs


示例2: TeamMapping

        private static void TeamMapping(IMapperConfiguration cfg)
        {
            cfg.CreateMap<TeamPlayerEntity, TeamPlayer>()
                .ForMember(
                    dest => dest.Type,
                    opts => opts.MapFrom(src => src.PlayerType));

            cfg.CreateMap<TeamEntity, Team>()
            .ForMember(
                dest => dest.ClubId,
                opts => opts.MapFrom(src => Constants.OwnClubId))
            .ForMember(
                dest => dest.Competition,
                opts => opts.MapFrom(src => Constants.NormalizeCompetition(src.Competition)))
            .ForMember(
                dest => dest.DivisionName,
                opts => opts.MapFrom(src => src.ReeksNummer + src.ReeksCode))
            .ForMember(
                dest => dest.Frenoy,
                opts => opts.MapFrom(src => new FrenoyTeamLinks
                {
                    DivisionId = src.FrenoyDivisionId,
                    LinkId = src.LinkId,
                    TeamId = src.FrenoyTeamId
                }))
            .ForMember(
                dest => dest.Players,
                opts => opts.MapFrom(src => src.Players))
            .ForMember(
                dest => dest.Opponents,
                opts => opts.MapFrom(src => MapAllTeams(src)))
            ;
        }
开发者ID:TTCErembodegem,项目名称:TTC-React-Back,代码行数:33,代码来源:AutoMapperConfig.cs


示例3: RenderDataObjectsAutoMapper

 public RenderDataObjectsAutoMapper(RequestContext context, IMapperConfiguration mapperConfiguration,
     IMapperExtensions mapperExtensions)
     : base(context.Zeus.Output)
 {
     this._mapperExtensions = mapperExtensions;
     this._mapperConfiguration = mapperConfiguration;
     this._context = context;
 }
开发者ID:kahanu,项目名称:CondorXE,代码行数:8,代码来源:RenderDataObjectsAutoMapper.cs


示例4: CreateMappings

 public override void CreateMappings(IMapperConfiguration configuration)
 {
     configuration.CreateMap<Organisation, OrganisationDetailsModel>()
         .ForMember(x => x.Owner, opt => opt.MapFrom(x => x.Owner.Email))
         .ForMember(
             x => x.Tests,
             opt => opt.MapFrom(x => x.Tests))
         .ForMember(x => x.Users, opt => opt.MapFrom(x => x.Users));
 }
开发者ID:damy90,项目名称:AvalancheAllerts,代码行数:9,代码来源:OrganisationDetailsModel.cs


示例5: ConfigureUserMapping

 private static void ConfigureUserMapping(IMapperConfiguration cfg)
 {
     cfg.CreateMap<UserToRegisterViewModel, User>();
     cfg.CreateMap<UserToLoginViewModel, User>();
     cfg.CreateMap<UserToActivateViewModel, User>();
     cfg.CreateMap<UserToRemindPasswordViewModel, User>();
     cfg.CreateMap<UserToSendActivationCodeViewModel, User>();
     cfg.CreateMap<UserToSendRemindPasswordRequestViewModel, User>();
     cfg.CreateMap<User, User>().ForAllMembers(opt => opt.Condition(c => !c.IsSourceValueNull));
 }
开发者ID:tjel,项目名称:infpro-8,代码行数:10,代码来源:AutoMapperConfiguration.cs


示例6: CreateMappings

 public void CreateMappings(IMapperConfiguration configuration)
 {
     configuration.CreateMap<User, UserInfoViewModel>()
         .ForMember(
             self => self.QuizzesCreated,
             opt => opt.MapFrom(model => model.QuizzesCreated.Count))
         .ForMember(
             self => self.QuizzesTaken,
             opt => opt.MapFrom(model => model.SolutionsSubmited.Count));
 }
开发者ID:kidroca,项目名称:project-quiz-mvc,代码行数:10,代码来源:UserInfoViewModel.cs


示例7: LoadCustomMappings

        private static void LoadCustomMappings(IEnumerable<Type> types, IMapperConfiguration mapperConfiguration)
        {
            var maps = types
                .Where(t => !t.IsInterface && !t.IsAbstract && t.GetInterfaces()
                    .Any(i => typeof(IHaveCustomMappings).IsAssignableFrom(i)))
                .Select(t => (IHaveCustomMappings)Activator.CreateInstance(t))
                .ToList();

            maps.ForEach(m => m.CreateMappings(mapperConfiguration));
        }
开发者ID:simeonpp,项目名称:Trip-Destination,代码行数:10,代码来源:AutoMapperConfig.cs


示例8: Configure

 //методы
 public static void Configure(IMapperConfiguration configuration)
 {
     configuration.CreateMap<SignalBounce<Guid>, SignalBounceGuid>();
     configuration.CreateMap<SignalDispatchBase<Guid>, SignalDispatchBaseGuid>();
     configuration.CreateMap<SubjectDispatch<Guid>, SubjectDispatchGuid>();
     configuration.CreateMap<UserCategorySettings<Guid>, UserCategorySettingsGuid>();
     configuration.CreateMap<UserDeliveryTypeSettings<Guid>, UserDeliveryTypeSettingsGuid>();
     configuration.CreateMap<UserReceivePeriod<Guid>, UserReceivePeriodGuid>();
     configuration.CreateMap<UserTopicSettings<Guid>, UserTopicSettingsGuid>();
 }
开发者ID:RodionKulin,项目名称:SignaloBot,代码行数:11,代码来源:MapperUtility.cs


示例9: Configure

 public void Configure(IMapperConfiguration mapperConfiguration)
 {
     mapperConfiguration.CreateMap<NewTask, Data.Entities.Task>()
         .ForMember(opt => opt.Version, x => x.Ignore())
         .ForMember(opt => opt.CreatedBy, x => x.Ignore())
         .ForMember(opt => opt.TaskId, x => x.Ignore())
         .ForMember(opt => opt.CreatedDate, x => x.Ignore())
         .ForMember(opt => opt.CompletedDate, x => x.Ignore())
         .ForMember(opt => opt.Status, x => x.Ignore())
         .ForMember(opt => opt.Users, x => x.Ignore());
 }
开发者ID:Ladex,项目名称:webapi,代码行数:11,代码来源:NewTaskToTaskEntityAutoMappingTypeConfiguration.cs


示例10: LoadAllMappings

        private static void LoadAllMappings(IMapperConfiguration config, params string[] assemblies)
        {
            var types = new List<Type>();
            foreach (var assembly in assemblies.Select(a => Assembly.Load(a)))
            {
                types.AddRange(assembly.GetExportedTypes());
            }

            LoadStandardMappings(config, types);
            LoadCustomMappings(config, types);
        }
开发者ID:vassildinev,项目名称:ASP.NET-MVC,代码行数:11,代码来源:AutoMapperConfig.cs


示例11: LoadCustomMappings

        private static void LoadCustomMappings(IEnumerable<Type> types, IMapperConfiguration mapperConfiguration)
        {
            var maps = (from t in types
                        from i in t.GetInterfaces()
                        where typeof(IHaveCustomMappings).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface
                        select (IHaveCustomMappings)Activator.CreateInstance(t)).ToArray();

            foreach (var map in maps)
            {
                map.CreateMappings(mapperConfiguration);
            }
        }
开发者ID:atanas-georgiev,项目名称:ASP.NET-MVC-Final-Project,代码行数:12,代码来源:AutoMapperConfig.cs


示例12: ConfigureMaps

        public static void ConfigureMaps(IMapperConfiguration cfg)
        {
            cfg.CreateMap< AuthLoginInfo, AuthLoginInfoPoco>()
            .ForMember(s => s.UserName, m => m.MapFrom(s => s.UserName))
            .ForMember(s => s.PasswordSalt, m => m.MapFrom(s => s.PasswordSalt))
            .ForMember(s => s.HashedPassword, m => m.MapFrom(s => s.HashedPassword));

              cfg.CreateMap<AuthLoginInfoPoco, AuthLoginInfo>()
            .ForMember(s => s.UserName, m => m.MapFrom(s => s.UserName))
            .ForMember(s => s.PasswordSalt, m => m.MapFrom(s => s.PasswordSalt))
            .ForMember(s => s.HashedPassword, m => m.MapFrom(s => s.HashedPassword));
        }
开发者ID:barbosatek,项目名称:Softmex,代码行数:12,代码来源:ObjectMapper.cs


示例13: LoadCustomMappings

        private static void LoadCustomMappings(IMapperConfiguration mapperConfiguration, IEnumerable<Type> types)
        {
            IEnumerable<IHaveCustomMappings> maps = types
                .SelectMany(t => t.GetInterfaces(), (t, i) => new { t, i })
                .Where(type => typeof(IHaveCustomMappings).IsAssignableFrom(type.t) &&
                               !type.t.IsAbstract &&
                               !type.t.IsInterface)
                .Select(type => (IHaveCustomMappings)Activator.CreateInstance(type.t));

            foreach (var map in maps)
            {
                map.CreateMappings(mapperConfiguration);
            }
        }
开发者ID:vassildinev,项目名称:ASP.NET-MVC,代码行数:14,代码来源:AutoMapperConfig.cs


示例14: LoadStandardMappings

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

            foreach (var map in maps)
            {
                mapperConfiguration.CreateMap(map.Source, map.Destination);
            }
        }
开发者ID:atanas-georgiev,项目名称:ASP.NET-MVC-Final-Project,代码行数:14,代码来源:AutoMapperConfig.cs


示例15: LoadCustomMappings

        private static void LoadCustomMappings(IMapperConfiguration mapperConfiguration, IList<Type> types)
        {
            var maps = (from t in types
                        from i in t.GetInterfaces()
                        where typeof(IHaveCustomMappings).IsAssignableFrom(t) &&
                              !t.IsAbstract &&
                              !t.IsInterface
                        select InitializeCustomMappingObject(t)).ToArray();

            foreach (var map in maps)
            {
                map.CreateMappings(mapperConfiguration);
            }
        }
开发者ID:csyntax,项目名称:BlogSystem,代码行数:14,代码来源:AutoMapperConfig.cs


示例16: ReportMapping

        private static void ReportMapping(IMapperConfiguration cfg)
        {
            cfg.CreateMap<MatchCommentEntity, MatchComment>().ReverseMap();
            cfg.CreateMap<MatchPlayerEntity, MatchPlayer>().ReverseMap();

            cfg.CreateMap<MatchGameEntity, MatchGame>()
                .ForMember(d => d.Outcome, o => o.MapFrom(src => src.WalkOver == WalkOver.None ? MatchOutcome.NotYetPlayed : MatchOutcome.WalkOver))
                .ForMember(
                    dest => dest.OutPlayerSets,
                    opts => opts.MapFrom(src => src.AwayPlayerSets))
                .ForMember(
                    dest => dest.OutPlayerUniqueIndex,
                    opts => opts.MapFrom(src => src.AwayPlayerUniqueIndex))
                .ReverseMap()
                ;
        }
开发者ID:TTCErembodegem,项目名称:TTC-React-Back,代码行数:16,代码来源:AutoMapperConfig.cs


示例17: LoadStandardMappings

        private static void LoadStandardMappings(IMapperConfiguration mapperConfiguration, IEnumerable<Type> types)
        {
            var maps = types
                .SelectMany(t => t.GetInterfaces(), (t, i) => new { t, i })
                .Where(type => type.i.IsGenericType &&
                               type.i.GetGenericTypeDefinition() == typeof(IMapFrom<>) &&
                               !type.t.IsAbstract &&
                               !type.t.IsInterface)
                .Select(type => new { Source = type.i.GetGenericArguments()[0], Destination = type.t });

            foreach (var map in maps)
            {
                mapperConfiguration.CreateMap(map.Source, map.Destination);
                mapperConfiguration.CreateMap(map.Destination, map.Source);
            }
        }
开发者ID:vassildinev,项目名称:ASP.NET-MVC,代码行数:16,代码来源:AutoMapperConfig.cs


示例18: LoadReverseMappings

        private static void LoadReverseMappings(IEnumerable<Type> types, IMapperConfiguration mapperConfiguration)
        {
            var maps = types
                .Where(t => !t.IsInterface && !t.IsAbstract && t.GetInterfaces()
                    .Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IMapTo<>)))
                .Select(t => new
                {
                    Source = t,
                    Destination = t.GetInterfaces()
                                .Where(i => i.GetGenericTypeDefinition() == typeof(IMapTo<>))
                                .FirstOrDefault()
                                .GetGenericArguments()[0]
                })
                .ToList();

            maps.ForEach(m => mapperConfiguration.CreateMap(m.Source, m.Destination));
        }
开发者ID:simeonpp,项目名称:Trip-Destination,代码行数:17,代码来源:AutoMapperConfig.cs


示例19: ConfigureMaps

        public static void ConfigureMaps(IMapperConfiguration cfg)
        {
            cfg.CreateMap<AuthLoginRequest, AuthLoginInfoPoco>()
            .ForMember(s => s.PlainPassword, m => m.MapFrom(s => s.PlainPassword))
            .ForMember(s => s.UserName, m => m.MapFrom(s => s.UserName));

              cfg.CreateMap<AuthLoginInfoPoco, AuthLoginRequest>()
            .ForMember(s => s.PlainPassword, m => m.MapFrom(s => s.PlainPassword))
            .ForMember(s => s.UserName, m => m.MapFrom(s => s.UserName));

              cfg.CreateMap<AuthLoginResponse, AuthLoginRequest>()
            .ForMember(s => s.UserName, m => m.MapFrom(s => s.UserName))
            .ForMember(s => s.PlainPassword, m => m.MapFrom(s => s.PlainPassword));

              cfg.CreateMap<AuthLoginRequest, AuthLoginResponse>()
            .ForMember(s => s.UserName, m => m.MapFrom(s => s.UserName))
            .ForMember(s => s.PlainPassword, m => m.MapFrom(s => s.PlainPassword));
        }
开发者ID:barbosatek,项目名称:Softmex,代码行数:18,代码来源:ObjectMapper.cs


示例20: ConfigureMaps

 private static void ConfigureMaps(IMapperConfiguration cfg)
 {
     ConfigureModelToDto(cfg);
     ConfigureDtoToModel(cfg);
 }
开发者ID:blackjackkent,项目名称:pipeline.net,代码行数:5,代码来源:AutoMapperConfiguration.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMapping类代码示例发布时间:2022-05-24
下一篇:
C# IMapper类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap