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


C# IMapper.Map方法代码示例

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


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

示例1: Photo

 public Photo(dynamic obj, IMapper<Photo> photoMapper)
 {
     photoMapper.Map(obj, this);
 }
开发者ID:kgarsuta,项目名称:iseahorse,代码行数:4,代码来源:Photo.cs

示例2: Observation

        public Observation(dynamic obj, IMapper<Observation> observationMapper)
        {
            Photos = new List<Photo>();
            Feedback = new List<FeedBack>();

            observationMapper.Map(obj, this);
        }
开发者ID:kgarsuta,项目名称:iseahorse,代码行数:7,代码来源:Observation.cs

示例3: UpkManagerController

    public UpkManagerController(UpkManagerViewModel ViewModel, MainMenuViewModel MenuViewModel, IMessenger Messenger, ISettingsRepository SettingsRepository, IExceptionRepository ExceptionRepository, IMapper Mapper) {
      if (Application.Current != null) Application.Current.DispatcherUnhandledException += onCurrentDispatcherUnhandledException;

      AppDomain.CurrentDomain.UnhandledException += onDomainUnhandledException;

      Dispatcher.CurrentDispatcher.UnhandledException += onCurrentDispatcherUnhandledException;

      TaskScheduler.UnobservedTaskException += onUnobservedTaskException;

      System.Windows.Forms.Application.ThreadException += onThreadException;

          viewModel =     ViewModel;
      menuViewModel = MenuViewModel;

      messenger = Messenger;

      settingsRepository  = SettingsRepository;
      exceptionRepository = ExceptionRepository;

      mapper = Mapper;

      settings = Task.Run(() => settingsRepository.LoadSettingsAsync()).Result;

      viewModel.Settings = mapper.Map<SettingsWindowViewEntity>(settings);

      registerMessages();
      registerCommands();
    }
开发者ID:stricq,项目名称:UPKManager,代码行数:28,代码来源:UpkManagerController.cs

示例4: GetCommentThreads

        private IList<CommentThreadModel> GetCommentThreads(Domain.Entity.Entities.Post post, IMapper mapper)
        {
            if (post.Comments == null) // sanity
            {
                return new List<CommentThreadModel>();
            }
            IEnumerable<Comment> roots = post.Comments.Where(comment => !comment.ParentId.HasValue);
            IList<CommentThreadModel> threads = roots.Select(comment => new CommentThreadModel
            {
                Original = mapper.Map<Comment, CommentModel>(comment),
                Replies = mapper.Map<IEnumerable<Comment>, IList<CommentModel>>(post.Comments.Where(c => c.ParentId == comment.Id)),
                Form = new CommentReplyModel(post.Id, comment.Id)
            }).ToList();

            return threads;
        }
开发者ID:bevacqua,项目名称:bruttissimo,代码行数:16,代码来源:CommentListModelMapper.cs

示例5: Fill

        public async Task<EditViewModel> Fill(IMapper mapper, Db db, Guest guest)
        {
            await base.Fill(db);

            mapper.Map(guest, this);

            return this;
        }
开发者ID:saxx,项目名称:Project-Dorothy,代码行数:8,代码来源:EditViewModel.cs

示例6: PageModule

        public PageModule(IPageService pageService,IMapper mapper): base("/pages")
        {
            if (pageService == null)
            {
                throw new ArgumentNullException(nameof(pageService));
            }

            this.pageService = pageService;
            this.mapper = mapper;

            Get["/"] = _ =>
            {
                var pages = pageService.GetAll().ToList();
                var pagesViewModel = mapper.Map<IEnumerable<Page>, IEnumerable<PageViewModel>>(pages);
                return pagesViewModel;
            };

            Get["/{id}"] = parameter => pageService.GetById(parameter.id) ?? HttpStatusCode.NotFound;

            Post["/"] = _ =>
            {
                var page = this.Bind<Page>();

                page = pageService.Add(page);

                return page;
            };

            Put["/{id}"] = parameter =>
            {
                var page = this.Bind<Page>();

                page.PageId = parameter.id;

                bool isUpdated = pageService.Update(page);

                return isUpdated ? HttpStatusCode.OK : HttpStatusCode.NotFound;
            };

            Delete["/{id}"] = parameter =>
            {
                var page = new Page() { PageId = parameter.id };

                bool isDeleted = pageService.Remove(page);

                return isDeleted ? HttpStatusCode.OK : HttpStatusCode.NotFound;
            };

            Post["/insert"] = _ =>
            {
                var pages = this.Bind<IEnumerable<Page>>();

                pageService.Insert(pages);

                return HttpStatusCode.OK;
            };
        }
开发者ID:RatingMarker,项目名称:PageMicroservice,代码行数:57,代码来源:PageModule.cs

示例7: ViewModelLocator

        public ViewModelLocator(IMapper mapper)
        {
            if (mapper == null) throw new ArgumentNullException(nameof(mapper));

            _mapper = mapper;

            _mapper.Map<ToolbarViewModel, ToolbarView>()
                   .Map<MainContentViewModel, MainContentView>()
                   .Map<ComponentTitleViewModel, ComponentTitleView>();

            Application.Current.Startup += ApplicationStartup;
        }
开发者ID:ethno2405,项目名称:BrailleTranslator,代码行数:12,代码来源:ViewModelLocator.cs

示例8: Setup

        public void Setup()
        {
            fieldMapper = new Mock<IMapper<IReadOnlyDictionary<string, string>, IEnumerable<XElement>>>();

            expectedFields = fixture.CreateMany<XElement>();

            fieldMapper.Setup(x => x.Map(It.IsAny<IReadOnlyDictionary<string, string>>()))
                .Returns(expectedFields);

            mapper = new CoinHeaderToXmlMapper(fieldMapper.Object);

            result = mapper.Map(input);
        }
开发者ID:jhonner72,项目名称:plat,代码行数:13,代码来源:CoinHeaderToXmlMapperTests.cs

示例9: CreateMaps

 public void CreateMaps(IMapper mapper)
 {
     mapper.CreateMap<Domain.Entity.Entities.Post, PostModel>()
         .ConstructUsing(ModelByLinkType)
         .BeforeMap((src, dest) => mapper.Map(src, dest, typeof(Domain.Entity.Entities.Post), dest.GetType()))
         .ForMember(dest => dest.Comments, opt => opt.MapFrom(src => src))
         .ForMember(
             dest => dest.PostSlug,
             opt => opt.MapFrom(src => postService.GetTitleSlug(src))
         )
         .ForMember(
             dest => dest.UserMessage,
             opt => opt.MapFrom(src => postService.BeautifyUserMessage(src.UserMessage, src))
         );
 }
开发者ID:bevacqua,项目名称:bruttissimo,代码行数:15,代码来源:PostModelMapper.cs

示例10: User

 public User(dynamic obj, IMapper<User> userMapper)
 {
     userMapper.Map(obj, this);
 }
开发者ID:kgarsuta,项目名称:iseahorse,代码行数:4,代码来源:User.cs

示例11: Identification

 public Identification(dynamic obj, IMapper<Identification> identificationMapper)
 {
     identificationMapper.Map(obj, this);
 }
开发者ID:kgarsuta,项目名称:iseahorse,代码行数:4,代码来源:Identification.cs

示例12: Setup

        public void Setup()
        {
            mapper = new CoinMetadataFieldToXmlMapper();

            result = mapper.Map(new ReadOnlyDictionary<string, string>(metadata));
        }
开发者ID:jhonner72,项目名称:plat,代码行数:6,代码来源:CoinMetadataFieldToXmlMapperTests.cs

示例13: Comment

 public Comment(dynamic obj, IMapper<Comment> commentMapper)
 {
     commentMapper.Map(obj, this);
 }
开发者ID:kgarsuta,项目名称:iseahorse,代码行数:4,代码来源:Comment.cs

示例14: Taxon

        public Taxon(dynamic obj, IMapper<Taxon> taxonMapper)
        {
            Photos = new List<Photo>();

            taxonMapper.Map(obj, this);
        }
开发者ID:kgarsuta,项目名称:iseahorse,代码行数:6,代码来源:Taxon.cs


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