Flexbase
Search…
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.
1
public class GetCustomerByIdOutputAPIModel : IFlexOutputAPIModel
2
{
3
//public string Id { get; set; }
4
public string Name { get; set; }
5
public DateTime DateOfBirth { get; set; }
6
}
Copied!
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.
1
public CustomerMapperConfiguration() : base()
2
{
3
#region Input
4
5
//Sample:
6
//CreateMap<YourAPIModel, YourDomainModel>();
7
8
CreateMap<AddCustomerInputAPIModel, Customer>();
9
10
#endregion
11
12
#region Output
13
14
//Sample:
15
//CreateMap<YourDomainModel, YourOutputAPIModel>();
16
17
CreateMap<Customer, GetCustomerByIdOutputAPIModel>();
18
19
20
#endregion
21
}
Copied!
Whenever query be executed, the customer is mapped to the GetCustomerById output API model.
Last modified 1yr ago
Copy link