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.
Questions tagged [automapper-5]
106 questions
1
vote
1 answer
AutoMapper mapping interface and ignoring column
I have the following code:
Interfaces
namespace Core.Interfaces
{
public interface ILoanApplicationBase
{
string ContactName { get; set; }
string Email { get; set; }
}
}
namespace App1.Core.Interfaces
{
public…

Josh
- 8,219
- 13
- 76
- 123
1
vote
0 answers
Automapper IValueResolver does not support Nullable type Guid
Recently I updated automapper 5+ version and realized that IValueresolver does not work as expected for Nullable type Guid.
I have created a value resolver as follows:
public class GanttTaskParentIdResolver : IValueResolver

Jayakaran Theivendramoorthy
- 1,186
- 1
- 14
- 23
1
vote
1 answer
AutoMapper IValueResolver throws error The type cannot be used as type parameter 'TValueResolver' in the generic type or method
I tried to implement IValueResolver interface in the new version of AutoMapper.
I have implemented ResourceTypeResolver class as follows..
public interface IValueResolver
{
TDestMember Resolve(TSource…

Jayakaran Theivendramoorthy
- 1,186
- 1
- 14
- 23
1
vote
1 answer
Setting up Automapper 5.1
I am having trouble following the wiki in this instance. I wanted to use Automapper 5.2. I cannot find a simple end for end example that shows a solid configuration with context. By context I mean where do you put the config files and whats the…

si2030
- 3,895
- 8
- 38
- 87
1
vote
2 answers
Automapper source prefix property
We are designing a temporal system where the definition of an entity can change. I am trying to setup Automapper but can't quite work out how the prefix should work.
As an example, I would have the following entity:
public class…

ciantrius
- 683
- 1
- 6
- 21
1
vote
0 answers
Automapper 5.2.0 and projections with EF6 throws Exception - bug?
When using Automapper 3.3.1 or 4.2.1 my code is running fine.
But after upgrade to 5.2.0 I get ArgumentException: "Type 'System.String' does not have a default constructor" in…

Jonny Bekkum
- 93
- 1
- 6
1
vote
1 answer
EF OData MySql Unknown column 'Project3.x' in 'where clause'
I'm using OData V4, EF6 and MySql 5.6/5.7
With below models and tables. I get the result of the Application resource fine with this call odata/Applications but I get this error when I expand on roles, as follows…

Ninos
- 224
- 4
- 18
1
vote
1 answer
Concurrency Access, Why EntityFramework 6 does not generate an DbUpdateConcurrencyException?
I have to manage concurrency in our Framework but I can not generate an DbUpdateConcurrencyException. We using SQL Server 2008, EF 6 and AutoMapper 5.
SQL
ALTER TABLE [Keyword].[Keyword] ADD Rowversion [Rowversion] NOT NULL
Model
[Table("Keyword",…

Antony FERRIERE
- 11
- 2
1
vote
0 answers
Build Configuration Dynamically at runtime
We have an old (hand-cranked) system that uses reflection to map one model with another. This uses Attributes on the models to work out what needs to be transmitted. This conversion is handled at runtime inside a base class in a shared project.
I'm…

Obsidian Phoenix
- 4,083
- 1
- 22
- 60
1
vote
2 answers
Automapper 5.1.1 inheritance mapping
Hello I cant get my mappings working for inherited class.
Idea is to create map for base object and interface only once, and when child classes implements their own members, configure mapping nly for those members that are not defined in base class…

PabloPC
- 41
- 4
1
vote
1 answer
AutoMapper version 5 mapping IDataReader
I'm trying to map from IDataReader into Person but I always get 0 results:
https://github.com/AutoMapper/AutoMapper/issues/874
Profile:
internal class ImportAddressProfile : Profile
{
private readonly IContainer _container;
public…

ShaneKm
- 20,823
- 43
- 167
- 296
1
vote
1 answer
Automapper (v5.1) ConstructedBy replacement?
I just upgraded my Automapper from 4.1 to 5.1 and I've found that ConstructedBy doesn't appear to be a valid function anymore. I read though the help files and it still references ConstructedBy as valid.
Here is what the code looks…

Michael James
- 61
- 7
1
vote
1 answer
Why do I get "Missing type map configuration or unsupported mapping" error in automapper?
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoMapper;
namespace TestAutomapper
{
class Program
{
static void Main(string[] args)
{
var config…

boggy
- 3,674
- 3
- 33
- 56
1
vote
0 answers
Cannot map from ViewModel to ApplicationUser in AutoMapper 5
I have a Student class inherited from ApplicationUser base class (ASP.NET Identity) and there is a ViewModel of it called StudentViewModel as shown below:
Entity Classes:
public class ApplicationUser : IdentityUser

Jack
- 1
- 21
- 118
- 236
1
vote
2 answers
C# Automapper Generic Mapping
When playing around with AutoMapper I was wondering whether the following is possible to implement like this (haven't been able to set it up correctly).
Base Service:
public class BaseService : IService where T : class,…

user2963570
- 381
- 6
- 21