Get method for API
Is it an ideal approach to set properties values before getting sending the JSON?
4 Replies
I don't know where or why you picked up that pattern, but don't ever do it like that
If you need to map a data structure to a different one, either use a library like AutoMapper or Mapster, use DTOs with LINQs select or write specific mapper classes
I looked at your code in code review. If you're using the setter of State to perform work, that's a terrible idea. Use a function for that at least
@Scratch function to update state?
Actually I have no idea what your original question is even trying to ask
Move whatever logic you're doing in the setter of State into its own method so you need to call that to perform that transition