QUERY : Output API Model

BasicCRUD Insert Query with Bridge

Now let us understand the query. So the first thing that we will look at in the query is the output API model.

We have the output API model in the customer: GetCustomerByIdOutputAPIModel. This was the feature created as GetCustomerById of type GetById. So we are maintaining a unique naming convention across the application. Lets create the output fields as Name and DateOfBirth, for the customer query.

public class GetCustomerByIdOutputAPIModel : IFlexOutputAPIModel
    {
        //public string Id { get; set; }
        public string Name { get; set; }
        public DateTime DateOfBirth { get; set; }
    }

Let us see how it simplifies the query in the next section. And this output API model Needs to be mapped with the domain model.

public CustomerMapperConfiguration() : base()
        {
            #region Input

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

            CreateMap<AddCustomerInputAPIModel, Customer>();

            #endregion

            #region Output

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

            CreateMap<Customer, GetCustomerByIdOutputAPIModel>();


            #endregion
        }

Whenever query be executed, the customer is mapped to the GetCustomerById output API model.

Last updated