Flexbase
  • Flexbase
  • Introduction
  • #JoyofCoding with Flexbase
  • Core Concepts
    • Flexbase
    • Flexstudio
      • Commands & Events
  • Thinking in Flexbase
    • Features and Modules
    • Designing APIs using Flexbase Control Flow
  • Sample Application
  • Solution Structure
    • Getting Started
      • Application
        • Introduction to Solution
        • Demo - Solution Generation
        • Solution Structure Overview
        • Architecture Overview
        • Clean architecture layer
        • Common Configurations
      • Features
        • Understanding Feature
        • Use Case
        • First Feature - Add Customer
        • Second Feature - Update Customer
        • Third Feature - Delete Customer
        • Query Features
  • Input Output Models
  • Messages
  • Domain
  • Pre Bus
  • Post Bus
  • Subscribers
  • Bus Gamma
  • Persistence
  • Hosting
  • Startup Code - WebAPI
  • Startup Code - Background Job
  • Endpoint - AppSettings
  • Bridge
  • Basic CRUD - Insert & Update
  • Introduction
  • View Generated API Definition in Swagger
  • Walkthrough Generated Code Insert
  • Walkthrough Generated Code Query GetById
  • Domain Model
  • Migration
  • AppSettings
  • Bus : How Basic Routing Config Works
  • INSERT : Input API Model
  • INSERT : Attribute Validation
  • INSERT : Plugin Validation
  • INSERT : Mapper
  • INSERT : Controller
  • INSERT : Services
  • INSERT : PostBus Handler
  • INSERT : PostBus Subscriber
  • INSERT : Demo In Action
  • QUERY : Output API Model
  • QUERY : Build and Fetch Pattern
  • QUERY : Demo In Action
  • Basic CRUD 2
    • Introduction
    • View Generated API Definition In Swagger
  • Walkthrough Generated Code Update
  • Walkthrough Generated Code Delete
  • Walkthrough Generated Code GetList
  • Walkthrough Generated Code Get Paged List
  • Update In Action
  • Delete In Action
  • GetList In Action
  • GetPagedList In Action
  • Konarch
Powered by GitBook
On this page

INSERT : Mapper

BasicCRUD Insert Query with Bridge

PreviousINSERT : Plugin ValidationNextINSERT : Controller

Last updated 4 years ago

Now let us look at our next topic Mapper. By default the mappers are created for you. So each module has its one mapper file for you so that your organization of the mapping becomes easy. So you can use this file for your both input mapping and output mapping and this uses AutoMapper internally.

So you can refer the documentation for AutoMapper to learn further on automapper and for any advanced mapping concept.

public class CustomerMapperConfiguration : FlexMapperProfile
    {
        /// <summary>
        /// 
        /// </summary>
        public CustomerMapperConfiguration() : base()
        {
            #region Input

            //Sample:
            //CreateMap<YourAPIModel, YourDomainModel>();

            CreateMap<AddCustomerInputAPIModel, Customer>();
            CreateMap<UpdateCustomerInputAPIModel, Customer>();

            #endregion

            #region Output

            //Sample:
            //CreateMap<YourDomainModel, YourOutputAPIModel>();

            CreateMap<Customer, GetCustomerByIdOutputAPIModel>();
            CreateMap<Customer, GetCustomersForLookupOutputAPIModel>();
            CreateMap<Customer, GetCustomersOutputAPIModel>();

            #endregion
        }
    }