jasontaylordev / NorthwindTraders

Northwind Traders is a sample application built using ASP.NET Core and Entity Framework Core.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] IHaveCustomMapping removed?

qazq opened this issue · comments

commented

IHaveCustomMapping removed?

In the branch dotnetcore22, I can use IHaveCustomMapping to create my custom mapping, but in the current branch, this file had been removed. How to create a custom mapping in the current version?

Thanks a lot.

IHaveCustomMapping was removed in favor of IMapFrom with a default method. (#183 ) MappingProfile.cs was also updated. To create a custom mapping, simply create a method called 'Mapping' in your class. e.g:

public class SomeDto : IMapFrom<Entity> 
{
  public int Id { get; set; }
  //Other properties here

  public void Mapping(Profile profile) {
    //Define custom mappings
    profile.CreateMap<Entity, SomeDto>....
  }
} 

Thank you for your interest in this project. This repository has been archived and is no longer actively maintained or supported. We appreciate your understanding. Feel free to explore the codebase and adapt it to your own needs if it serves as a useful reference. If you have any further questions or concerns, please refer to the README for more information.