Questions tagged [automapper-5]

Use this tag for version specific questions about AutoMapper 5 - the convention-based object-to-object mapper and transformer library for .NET. When using this tag also include the more generic [automapper] tag where possible.

106 questions
0
votes
1 answer

AutoMapper 5 when set CreateMissingTypeMaps true ForMember not work

I think I found the cause of the problem, but I don't know how to solve it, the scene is like this: i used automapper 5.2 , Entity Framework 6 and use CreateMissingTypeMaps=true to save my CreateMap code and i also have special map, so Initialize…
Gavin
  • 11
  • 3
0
votes
1 answer

Field to field mapping between list of dynamic and list of class with Automapper

I have bellow function which returns a list of dynamic object public List getlist() { List d = new List(); d.Add(new { Name = "A", Age = 12 }); d.Add(new { Name = "B", Age = 10…
kuntal
  • 1,591
  • 2
  • 16
  • 36
0
votes
1 answer

Automapper 5.2 with inheritance not working

I have an Entity: public abstract class BaseEntity { public Int16 Id { get; set; } public DateTime Timestamp { get; set; } } public class Certificate : BaseEntity { public String Name { get; set; } public String Authority { get;…
user2970104
  • 41
  • 1
  • 7
0
votes
0 answers

Configure mapFrom expression just once in Automapper for JObject for a common access pattern

I am mapping from a JObject to a custom class and it works fine, but i'd rather tell it to do this default type of mapping once instead of having to do a .MapFrom for every property. Most of the source "properties" are just the lowercase underscored…
ManOfSteele
  • 281
  • 1
  • 15
0
votes
2 answers

Is it possible to use methods with new MapperConfiguration?

I got a very simple question... Is it possible to setup a AutoMapper like this: public IMapper Init() { var config = new MapperConfiguration(cfg => { cfg = MappingModelsToViewModels(cfg); }); return…
David Létourneau
  • 1,250
  • 2
  • 19
  • 39
0
votes
1 answer

Automapper multiple sources for profiles

Prior to assembly scanning (circa 4.x) we did something like the following to provide a centralised approach to adding profiles: /// /// Class that allows all the AutoMapper profiles to be initiated for all assemblies within the…
TheEdge
  • 9,291
  • 15
  • 67
  • 135
0
votes
1 answer

AutoMapper projection error

I have get method in web api: public async Task Get() { var categories = await _context.Categories.Include(x => x.SubCategories) .Where(c => c.IsActive) …
MANISH KUMAR CHOUDHARY
  • 3,396
  • 3
  • 22
  • 34
0
votes
1 answer

Ignoring unmapped members after ConvertUsing

this is my code : public class UserProfile:Profile { public UserProfile() { CreateMap().ConvertUsing(); } } public class UserEncryptor : ITypeConverter
paradise_human
  • 685
  • 2
  • 14
  • 31
0
votes
1 answer

AutoMapper mapping from type to type with nested type

I'm using the latest version, with the instance API. My source type: public class Source { public string ValueX { get; set; } public string ValueY { get; set; } public string ValueZ { get; set; } } My destination type: public class…
grokky
  • 8,537
  • 20
  • 62
  • 96
0
votes
1 answer

Automapper 5 do not map collections collections defined with read only properties

When I upgraded to Automapper 5.1.1, mapping of collections that are defined with readonly properties stopped to work (this works perfectly fine using Automapper 4.2.1) Here is a sample code that you can try using both versions of Automapper to…
Marcos
  • 151
  • 1
  • 9
0
votes
1 answer

Missing type map configuration or unsupported mapping in Automapper 5.0.2

I am using AutoMapper in my OData API. I found many questions with the same title and also tried all solutions, but my problem not get resolved. I am using latest AutoMapper version 5.0.2. Please let me know where I am going wrong. Here is my code…
Uddhao Pachrne
  • 531
  • 1
  • 8
  • 22
0
votes
1 answer

AutoMapper 5.x No Longer Supports MemberName in ResolutionContext

In previous versions of AutoMapper I created a general purpose PreCondition to conditionally map/not map certain members. I achieved this by adding an array of member names to the Map options and checking this list against the member currently…
moomoo
  • 826
  • 10
  • 9
0
votes
0 answers

Issues implementing the new version of AutoMapper

Hi I am creating the following Web API method which returns data transfer object. The new version of the Auto Mapper works differently. Below is the old way, could somebody help me with the new approach This is an example of AutoMapping using an old…
Tom
  • 8,175
  • 41
  • 136
  • 267
0
votes
1 answer

Nested Collections Not Working in AutoMapper 5.1

Trying to upgrade to AutoMapper 5.1 from v4.2 and am finding that a collection isn't mapping at runtime - the source object has items in the collection, but the mapped destination property is empty. Under 4.2, everything worked exactly as expected…
Mr. T
  • 3,892
  • 3
  • 29
  • 48
0
votes
1 answer

Get related array from another table by foreign key

I'm using SQL Server 2012, MVC WebAPI, AutoMapper and Entity Framework. In the database I have two tables with one-to-many relation, for example Categories and Products; a category can have more products but a product can have only one category.…
chenny
  • 769
  • 2
  • 17
  • 44