automapper

Missing type map configuration or unsupported mapping

萝らか妹 提交于 2019-12-08 07:16:28
Could somebody please explain what this error means? I have used automapper onces before but never had this kind of error. Error The server encountered an error processing the request. The exception message is 'Missing type map configuration or unsupported mapping. Mapping types: Char -> QuestionDto System.Char -> CollectiveDistributedPolling.QuestionDto Destination path: QuestionDto.Question1.Question1.Question10[0] Source value: R'. Service1.svc.cs public Service1() { Mapper.CreateMap<Question, QuestionDto>(); Mapper.CreateMap<QuestionDto, Question>(); } private Question MapToQuestion

Mapper not initialized. Call Initialize with appropriate configuration [duplicate]

核能气质少年 提交于 2019-12-08 06:13:29
问题 This question already has answers here : Automapper error saying mapper not initialized (2 answers) Closed 7 months ago . I get error when usinng AutoMaper for netcore 2.1 projet Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource extension methods, make sure you pass in the

AutoMapper failing to map a simple list

谁都会走 提交于 2019-12-08 05:57:23
问题 I have used automapper for mapping lists in the past, for for some reason it won't work in this case. public class MyType1 { public int Id { get; set; } public string Description { get; set; } } public class MyType2 { public int Id { get; set; } public string Description { get; set; } } public void DoTheMap() { Mapper.CreateMap<MyType2, MyType1>(); Mapper.AssertConfigurationIsValid(); var theDto1 = new MyType2() { Id = 1, Description = "desc" }; var theDto2 = new MyType2() { Id = 2,

Should AutoMapper also be used as a Re-Shape mapping tool

泪湿孤枕 提交于 2019-12-08 05:06:37
问题 I know AutoMapper is just to map properties between 2 objects. Automapper is not for reshaping data this must be programmed in my opinion. I have a PeriodDTO.IEnumerable<Period> which needs to be reshaped into a PeriodListViewModel.List<CellViewModel> . Each CellViewModel holds a List<RowViewModel> This is no 1 to 1 mapping not and I guess maybe this should not be mapped - because its not possible - public class PeriodRequest { public IEnumerable<Period> Periods { get; set; } public

How to pass values to a Custom Resolver in Automapper?

十年热恋 提交于 2019-12-08 04:55:01
问题 I need to pass values to my Custom Resolver. The values change, so I can't hard code them in my register static class. How can I achieve this? // Called from global.asa page public static void Register() { Mapper.CreateMap<Task, TaskTableViewModel>().ForMember(dest => dest.DueDate, opt => opt.ResolveUsing<DueDateResolver>().ConstructedBy(() => new DueDateResolver(dateFormatString))); } 回答1: I asked about this on another board and was told it isn't possible to do in this version. 来源: https:/

Entity core Mapping entity types with join table

可紊 提交于 2019-12-08 03:43:30
问题 I've started using entity core and I ran into one problem. I'm using automapper in my project and don't know how to populate my join table(BookAuthor). In MVC I worked with ICollections but entity core does not yet support working with many to many relationship entities and now I have to work with join table. Question: How can i map my Bookviewmodel to the Book? I don't know what should I do with my BookAuthors list. Maybe I shouldn't populate it? I tried something like that but it's not

How to ignore an inner nested object when using AutoMapper

橙三吉。 提交于 2019-12-08 02:47:35
问题 Hello I have the classes: Class User public class User { public Int64 Id { get; set; } public string Name { get; set; } public string Email { get; set; } public Profile Profile { get; set; } //EF one to one } Class Profile public class Profile { public Int64 Id { get; set; } public string Skype { get; set; } public string Phone { get; set; } public string Mobile { get; set; } public virtual ICollection<Address> Addresses { get; set; } public virtual User User { get; set; } //This is because

Mapping Expression<Func<Type1,bool>> Expression<Func<Type2, bool>>

社会主义新天地 提交于 2019-12-07 23:00:20
问题 I want to pass my query from Business Layer to Service Layer but when doing this i have to convert my DTO to Entity model. Normally i can convert Type1 to Type2 via Autommaper but now i want to map Expression<Func<Type1,bool>> to Expression<Func<Type2, bool>> I got error from Automapper Missing type map configuration or unsupported mapping. Mapping types: Expression`1 -> Expression`1 How can i achieve this? 回答1: I just updated my answer to the another question you commented on, which I think

Changing the web.config takes the WCF service down?

余生长醉 提交于 2019-12-07 22:51:36
问题 I have a simple WCF service hosted on IIS. Anytime I change the web.config file the service goes down and shows the following error: Could not load file or assembly 'AutoMapper, Version=1.1.0.188, Culture=neutral, PublicKeyToken=be96cd2c38ef1005' or one of its dependencies. Logon failure: unknown user name or bad password. (Exception from HRESULT: 0x8007052E) To correct it, I need to delete all existing files and re-publish the WCF service. Re-publishing without deleting old files doesn't

Is a mapping library like AutoMapper available on the .NET Compact Framework 3.5?

家住魔仙堡 提交于 2019-12-07 22:41:08
问题 Is anyone working on a .NET Compact Framework port of AutoMapper or are there any similar mapping libraries for the .NET Compact Framework? 回答1: You could build on OmuMapper ? (UPDATE: @Omu himself has since built ValueInjecter). (Obviously there's a strong chance this wont meet many challenges you might place in front of it. Are you really interested in all the AM features? Is size an issue? Any more context you can give?) EDIT: As they've RTW'd over at AutoMapper Maybe now is the perfect