When I retrieve data from database I name the class as Model
, for example UserModel
.
When I send data to the View I name the class as ViewModel
, for example UserSettingsViewModel
.
How to name the class that exchange data between layers?
When I retrieve data from database I name the class as Model
, for example UserModel
.
When I send data to the View I name the class as ViewModel
, for example UserSettingsViewModel
.
How to name the class that exchange data between layers?
My suggestion is to omit the 'Model' suffix from your main class. I have seen 'DataTransport' or 'DT' classes, but generally you shouldnt need a separate class for this.
example classes
or in an api where you send data over the wire
A Gateway suffix is also used, for example DataAccessGateway between the DAL and the business logic layer is responsible to convert the data to a model object that is received by the business logic that works with a model of the data