Questions tagged [automapper-7]

Use this tag for version specific questions about AutoMapper 7 - 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.

17 questions
1
vote
0 answers

How do I upgrade this TypeConverter to use the latest version of AutoMapper?

I'm trying to upgrade some code that I didn't write from AutoMapper 4.0.4 to 7.0.1 and I'm running into an issue. There is a TypeConverter that looks like this: public class BaseListTypeConverter : ITypeConverter
adam0101
  • 29,096
  • 21
  • 96
  • 174
1
vote
0 answers

What does AutoMapper do when duplicate mappings are defined?

I'm upgrading code to use the latest version of AutoMapper in a very large solution. In several of the AutoMapper profiles there are duplicate bindings between two objects - each with different calls to ForMember(). These went unnoticed by…
adam0101
  • 29,096
  • 21
  • 96
  • 174
1
vote
1 answer

Keeping AutoMapper ProjectTo() DRY When Properties Have the Same Code

I want to use AutoMapper's queryable extensions (.ProjectTo), but I can't figure out how to do it without copying the code in many of my properties on the database objects and duplicating it in the projection. Here's an example that both overrides…
pbristow
  • 1,997
  • 4
  • 26
  • 46
0
votes
0 answers

Migration ASP.NET Core 6.0 to 7.0

Project works fine in ASP.NET Core 6.0 but when I tried to migrate it to 7.0, it builds successfully without errors but at runtime I got this error: Message "GenericArguments[0], 'AbilityFix.Model.Models.Forums', on 'T MaxIntegerT' violates the…
User
  • 1,334
  • 5
  • 29
  • 61
0
votes
3 answers

How do I map a navigation property that is the same type as the class I'm mapping?

I'm trying to map a class Function to another one called FunctionDTO using AutoMapper. The classes look like this: public class Function { ... public int MasterFunctionId { get; set; } public Function MasterFunction { get; set; } …
Corvo
  • 147
  • 1
  • 11
0
votes
1 answer

E.F Core and Automapper not getting all data when getting by id

I'm using EF Core and Auto Mapper in an ASP.NET CORE api and I am having a little bit of trouble understanding why I am not getting all my data when I get it by ID. When I debug and look at the data it is all there in the variable but when it hits…
DRW
  • 335
  • 1
  • 3
  • 17
0
votes
1 answer

Why is AutoMapper throwing the error AutoMapperConfigurationException?

I have four classes - two view models and two entities: PhoneNumberTypeViewModel: public class PhoneNumberTypeViewModel { public int Id { get; private set; } public string Description { get; set; } public PhoneNumberTypeViewModel(int…
Mike Lenart
  • 767
  • 1
  • 5
  • 19
0
votes
1 answer

AutoMapper 9.0.0 (non static) gives Missing type map configuration or unsupported mapping error

I have a ASP.Net Web API that was using Automapper 7.0.1 with static mappings. I recently upgraded to Automapper 9.0.0 which does not have static mappings. So, I used the recommended way of using my Dependency Container (Unity Container) to register…
bit
  • 4,407
  • 1
  • 28
  • 50
0
votes
1 answer

Missing type map configuration or unsupported mapping.while trying to assign the data to DTO object

I am using AutoMapper.Extensions.Microsoft.DependencyInjection. I am using the Automapper NuGet package: AutoMapper.Extensions.Microsoft.DependencyInjection (7.0.0) for ASP.NET Core 3.1 application. Here goes my domain object: file…
santosh kumar patro
  • 7,231
  • 22
  • 71
  • 143
0
votes
0 answers

AutoMapper: map entities to a destination with a suffix

Given the following example: class Source: int Id; DateTimeOffSet StartDate; DateTimeOffSet EndDate; ... class Destination: int Id; DateTimeOffSet StartDate; DateTimeOffSet StartDateUtc; DateTimeOffSet EndDate; DateTimeOffSet EndDateUtc; ... How…
Żubrówka
  • 730
  • 1
  • 10
  • 24
0
votes
0 answers

Issue in mapping Automapper configuration

I have the following POCO classes: public class Employees { public int EmployeeId { get; set; } public int EmpImageId { get; set; } public string EmployeePhotoUrl { get; …
santosh kumar patro
  • 7,231
  • 22
  • 71
  • 143
0
votes
0 answers

How to configure the MappingProfile using Automapper?

I am using asp.net core 2.2, Microsoft.EntityFrameworkCore(2.2.4), Microsoft.EntityFrameworkCore.Cosmos(2.2.4), AutoMapper.Extensions.Microsoft.DependencyInjection(7.0.0) Here goes my code: MappingProfile.cs public class MappingProfile : Profile { …
santosh kumar patro
  • 7,231
  • 22
  • 71
  • 143
0
votes
1 answer

Automapper ProjectTo not working when used with custom mapping

I am using asp.net core 2.2, Microsoft.EntityFrameworkCore(2.2.4), Microsoft.EntityFrameworkCore.Cosmos(2.2.4), AutoMapper.Extensions.Microsoft.DependencyInjection(7.0.0) Here goes my code: MappingProfile.cs public class MappingProfile : Profile { …
santosh kumar patro
  • 7,231
  • 22
  • 71
  • 143
0
votes
0 answers

AutoMapper ignores not derived properties on dynamic, or not fully qualified mapping configuration

I am facing a problem with my .NET CORE 2.1 code and AutoMapper for mapping DTOs to DomainModels and vice versa. Originally I am using a CreateRequest DTO for creating data, which is mapped to my domain model. For update reasons I use an…
Spell0
  • 51
  • 8
0
votes
0 answers

Automapper 7.0.1 ProjectTo mismatch types with ef core 2.1.1 linq join

Full exemple in Console application gist I have some entities with readonly property that is calculated. This is my Automapper mapping config to calculate the property. cfg.CreateMap(t, t).ForMember(nameof(ITestInterface.IsReadOnly), opt =>…
1
2