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


C# IMapperConfiguration类代码示例

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


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


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