I'm converting a java back-end to a .net core back-end. Finally starting to kind of get a little more comfortable with this, at least.
I have a question on what exactly the purpose of this is.
From: ecommerce-backend/UserCreateDto.java at master · webtutsplus/ecommerce-backend
I don't quite understand why they would use getFirstName(), setFirstName(String firstName), etc. Reading stackoverflow, it seems like this may be a java thing.
What I see doing is just letting Dapper fill the DTO object and using it.
What they are doing is using the above in their service layer, like this:
I'm just curious on some observations on this from someone smarter than me.
Thanks,
I have a question on what exactly the purpose of this is.
From: ecommerce-backend/UserCreateDto.java at master · webtutsplus/ecommerce-backend
C#:
public class UserCreateDto {
private String firstName;
private String lastName;
private String email;
private Role role;
private String password;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
...etc.
}
I don't quite understand why they would use getFirstName(), setFirstName(String firstName), etc. Reading stackoverflow, it seems like this may be a java thing.
What I see doing is just letting Dapper fill the DTO object and using it.
What they are doing is using the above in their service layer, like this:
C#:
User user = new User(userCreateDto.getFirstName(), userCreateDto.getLastName(), userCreateDto.getEmail(), userCreateDto.getRole(), encryptedPassword );
User createdUser;
I'm just curious on some observations on this from someone smarter than me.
Thanks,